Skip to content

Commit fbed381

Browse files
Perduhunleyd
andauthored
Fix CI error reported by ansible-lint (ansible-collections#900)
Co-authored-by: Douglas J Hunley <doug.hunley@gmail.com>
1 parent 9f1898c commit fbed381

File tree

8 files changed

+18
-26
lines changed

8 files changed

+18
-26
lines changed

plugins/modules/postgresql_copy.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
'''
182182

183183
from ansible.module_utils.basic import AnsibleModule
184-
from ansible.module_utils.six import iteritems
185184
from ansible_collections.community.postgresql.plugins.module_utils.database import (
186185
check_input,
187186
pg_quote_identifier,
@@ -296,11 +295,11 @@ def copy_to(self):
296295

297296
def __transform_options(self):
298297
"""Transform options dict into a suitable string."""
299-
for (key, val) in iteritems(self.module.params['options']):
298+
for (key, val) in self.module.params['options'].items():
300299
if key.upper() in self.opt_need_quotes:
301300
self.module.params['options'][key] = "'%s'" % val
302301

303-
opt = ['%s %s' % (key, val) for (key, val) in iteritems(self.module.params['options'])]
302+
opt = ['%s %s' % (key, val) for (key, val) in self.module.params['options'].items()]
304303
return '(%s)' % ', '.join(opt)
305304

306305
def __check_table(self, table):
@@ -365,7 +364,7 @@ def main():
365364
# Check input for potentially dangerous elements:
366365
opt_list = None
367366
if module.params['options']:
368-
opt_list = ['%s %s' % (key, val) for (key, val) in iteritems(module.params['options'])]
367+
opt_list = ['%s %s' % (key, val) for (key, val) in module.params['options'].items()]
369368

370369
check_input(module,
371370
module.params['copy_to'],

plugins/modules/postgresql_info.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156

157157
from ansible.module_utils.common.text.converters import to_native
158158
from ansible.module_utils.basic import AnsibleModule
159-
from ansible.module_utils.six import iteritems
160159
from ansible_collections.community.postgresql.plugins.module_utils.database import \
161160
check_input
162161
from ansible_collections.community.postgresql.plugins.module_utils.postgres import (
@@ -317,7 +316,7 @@ def get_pub_info(self):
317316
if not publications.get(elem['pubname']):
318317
publications[elem['pubname']] = {}
319318

320-
for key, val in iteritems(elem):
319+
for key, val in elem.items():
321320
if key != 'pubname':
322321
publications[elem['pubname']][key] = val
323322

@@ -355,7 +354,7 @@ def get_subscr_info(self):
355354
if not subscr_info[elem['dbname']].get(elem['subname']):
356355
subscr_info[elem['dbname']][elem['subname']] = {}
357356

358-
for key, val in iteritems(elem):
357+
for key, val in elem.items():
359358
if key not in ('subname', 'dbname'):
360359
subscr_info[elem['dbname']][elem['subname']][key] = val
361360

plugins/modules/postgresql_publication.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@
254254

255255

256256
from ansible.module_utils.basic import AnsibleModule
257-
from ansible.module_utils.six import iteritems
258257
from ansible_collections.community.postgresql.plugins.module_utils.database import (
259258
check_input, pg_quote_identifier)
260259
from ansible_collections.community.postgresql.plugins.module_utils.postgres import (
@@ -328,7 +327,7 @@ def transform_rowfilters_keys(rowfilters):
328327
rowfilters (dict): Changed dict.
329328
"""
330329
revmap_filters = {}
331-
for table, fltr in iteritems(rowfilters):
330+
for table, fltr in rowfilters.items():
332331
fltr = fltr.strip()
333332
if fltr:
334333
if fltr[:5].lower() == 'where':
@@ -521,7 +520,7 @@ def create(self, tables, tables_in_schema, columns, rowfilters, params, owner, c
521520
if params:
522521
params_list = []
523522
# Make list ["param = 'value'", ...] from params dict:
524-
for (key, val) in iteritems(params):
523+
for (key, val) in params.items():
525524
params_list.append("%s = '%s'" % (key, val))
526525

527526
# Add the list to query_fragments:
@@ -634,7 +633,7 @@ def update(self, tables, tables_in_schema, columns, rowfilters, params, owner, c
634633

635634
# Update pub parameters:
636635
if params:
637-
for key, val in iteritems(params):
636+
for key, val in params.items():
638637
if self.attrs['parameters'].get(key):
639638

640639
# In PostgreSQL 10/11 only 'publish' optional parameter is presented.
@@ -875,7 +874,7 @@ def __pub_set_columns(self, columns_map, rowfilters, check_mode=False):
875874
True if successful, False otherwise.
876875
"""
877876
table_list = []
878-
for table, columns in iteritems(columns_map):
877+
for table, columns in columns_map.items():
879878
quoted_cols = pg_quote_column_list(table, columns)
880879
if table in rowfilters:
881880
quoted_cols += (" WHERE %s" % rowfilters[table])
@@ -1035,7 +1034,7 @@ def main():
10351034
if not params:
10361035
params_list = None
10371036
else:
1038-
params_list = ['%s = %s' % (k, v) for k, v in iteritems(params)]
1037+
params_list = ['%s = %s' % (k, v) for k, v in params.items()]
10391038

10401039
check_input(module, name, tables, owner,
10411040
session_role, params_list, comment)

plugins/modules/postgresql_query.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@
266266

267267
from ansible.module_utils.common.text.converters import to_native
268268
from ansible.module_utils.basic import AnsibleModule
269-
from ansible.module_utils.six import iteritems
270269
from ansible_collections.community.postgresql.plugins.module_utils.database import \
271270
check_input
272271
from ansible_collections.community.postgresql.plugins.module_utils.postgres import (
@@ -419,7 +418,7 @@ def main():
419418
# Ansible engine does not support decimals.
420419
# An explicit conversion is required on the module's side
421420
row = dict(row)
422-
for (key, val) in iteritems(row):
421+
for (key, val) in row.items():
423422
if isinstance(val, TYPES_NEED_TO_CONVERT):
424423
row[key] = convert_to_supported(val)
425424

plugins/modules/postgresql_script.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@
216216

217217
from ansible.module_utils.common.text.converters import to_native
218218
from ansible.module_utils.basic import AnsibleModule
219-
from ansible.module_utils.six import iteritems
220219
from ansible_collections.community.postgresql.plugins.module_utils.database import \
221220
check_input
222221
from ansible_collections.community.postgresql.plugins.module_utils.postgres import (
@@ -339,7 +338,7 @@ def main():
339338
# Ansible engine does not support decimals.
340339
# An explicit conversion is required on the module's side
341340
row = dict(row)
342-
for (key, val) in iteritems(row):
341+
for (key, val) in row.items():
343342
if isinstance(val, TYPES_NEED_TO_CONVERT):
344343
row[key] = convert_to_supported(val)
345344

plugins/modules/postgresql_subscription.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
from copy import deepcopy
215215

216216
from ansible.module_utils.basic import AnsibleModule
217-
from ansible.module_utils.six import iteritems
218217
from ansible_collections.community.postgresql.plugins.module_utils.database import \
219218
check_input
220219
from ansible_collections.community.postgresql.plugins.module_utils.postgres import (
@@ -247,7 +246,7 @@ def convert_conn_params(conn_dict):
247246
Connection string.
248247
"""
249248
conn_list = []
250-
for (param, val) in iteritems(conn_dict):
249+
for (param, val) in conn_dict.items():
251250
conn_list.append('%s=%s' % (param, val))
252251

253252
return ' '.join(conn_list)
@@ -263,7 +262,7 @@ def convert_subscr_params(params_dict):
263262
Parameters string.
264263
"""
265264
params_list = []
266-
for (param, val) in iteritems(params_dict):
265+
for (param, val) in params_dict.items():
267266
if val is False:
268267
val = 'false'
269268
elif val is True:
@@ -280,7 +279,7 @@ def cast_connparams(connparams_dict):
280279
Returns:
281280
Dictionary
282281
"""
283-
for (param, val) in iteritems(connparams_dict):
282+
for (param, val) in connparams_dict.items():
284283
try:
285284
connparams_dict[param] = int(val)
286285
except ValueError:
@@ -423,7 +422,7 @@ def update(self, connparams, publications, subsparams, check_mode=True):
423422
if subsparams:
424423
params_to_update = []
425424

426-
for (param, value) in iteritems(subsparams):
425+
for (param, value) in subsparams.items():
427426
if param == 'enabled':
428427
if self.attrs['enabled'] and value is False:
429428
changed = self.enable(enabled=False, check_mode=check_mode)

plugins/modules/postgresql_tablespace.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@
192192
'''
193193

194194
from ansible.module_utils.basic import AnsibleModule
195-
from ansible.module_utils.six import iteritems
196195
from ansible_collections.community.postgresql.plugins.module_utils.database import \
197196
check_input
198197
from ansible_collections.community.postgresql.plugins.module_utils.postgres import (
@@ -455,7 +454,7 @@ def main():
455454
if not settings:
456455
settings_list = None
457456
else:
458-
settings_list = ['%s = %s' % (k, v) for k, v in iteritems(settings)]
457+
settings_list = ['%s = %s' % (k, v) for k, v in settings.items()]
459458

460459
check_input(module, tablespace, location, owner,
461460
rename_to, session_role, settings_list, comment)

plugins/modules/postgresql_user_obj_stat_info.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
'''
108108

109109
from ansible.module_utils.basic import AnsibleModule
110-
from ansible.module_utils.six import iteritems
111110
from ansible_collections.community.postgresql.plugins.module_utils.database import \
112111
check_input
113112
from ansible_collections.community.postgresql.plugins.module_utils.postgres import (
@@ -252,7 +251,7 @@ def __fill_out_info(self, result, info_key=None, schema_key=None, name_key=None)
252251
self.info[info_key][elem[schema_key]][elem[name_key]] = {}
253252

254253
# Add other other attributes to a certain index:
255-
for key, val in iteritems(elem):
254+
for key, val in elem.items():
256255
if key not in (schema_key, name_key):
257256
self.info[info_key][elem[schema_key]][elem[name_key]][key] = val
258257

0 commit comments

Comments
 (0)