|
14 | 14 | '''
|
15 | 15 |
|
16 | 16 | from pyinfra.api import MaskString, operation, StringCommand
|
17 |
| -from pyinfra.facts.postgresql import make_execute_psql_command, make_psql_command |
| 17 | +from pyinfra.facts.postgresql import ( |
| 18 | + make_execute_psql_command, |
| 19 | + make_psql_command, |
| 20 | + PostgresqlDatabases, |
| 21 | + PostgresqlRoles, |
| 22 | +) |
18 | 23 |
|
19 | 24 |
|
20 | 25 | @operation(is_idempotent=False)
|
@@ -90,9 +95,12 @@ def role(
|
90 | 95 |
|
91 | 96 | '''
|
92 | 97 |
|
93 |
| - roles = host.fact.postgresql_roles( |
94 |
| - postgresql_user, postgresql_password, |
95 |
| - postgresql_host, postgresql_port, |
| 98 | + roles = host.get_fact( |
| 99 | + PostgresqlRoles, |
| 100 | + postgresql_user=postgresql_user, |
| 101 | + postgresql_password=postgresql_password, |
| 102 | + postgresql_host=postgresql_host, |
| 103 | + postgresql_port=postgresql_port, |
96 | 104 | )
|
97 | 105 |
|
98 | 106 | is_present = role in roles
|
@@ -188,9 +196,12 @@ def database(
|
188 | 196 |
|
189 | 197 | '''
|
190 | 198 |
|
191 |
| - current_databases = host.fact.postgresql_databases( |
192 |
| - postgresql_user, postgresql_password, |
193 |
| - postgresql_host, postgresql_port, |
| 199 | + current_databases = host.get_fact( |
| 200 | + PostgresqlDatabases, |
| 201 | + postgresql_user=postgresql_user, |
| 202 | + postgresql_password=postgresql_password, |
| 203 | + postgresql_host=postgresql_host, |
| 204 | + postgresql_port=postgresql_port, |
194 | 205 | )
|
195 | 206 |
|
196 | 207 | is_present = database in current_databases
|
|
0 commit comments