fixed Python 3 keys() usage (#1861)

* fixed python3 keys()

* added changelog fragment

* Update plugins/modules/cloud/spotinst/spotinst_aws_elastigroup.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/cache/redis.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* rolledback redis.py per PR

* Update plugins/modules/monitoring/sensu/sensu_check.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* removed unnecessary ignore lines

* adding memcached and one case in redis is indeed necessary

* Update changelogs/fragments/1861-python3-keys.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/1861-python3-keys.yml

* Update changelogs/fragments/1861-python3-keys.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2021-02-24 11:19:27 +13:00 committed by GitHub
parent e353390e6c
commit 434f383ae9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 64 additions and 50 deletions

View file

@ -1662,7 +1662,7 @@ def main():
),
backing_store=dict(
type='str',
choices=LXC_BACKING_STORE.keys(),
choices=list(LXC_BACKING_STORE.keys()),
default='dir'
),
template_options=dict(
@ -1699,7 +1699,7 @@ def main():
type='path'
),
state=dict(
choices=LXC_ANSIBLE_STATES.keys(),
choices=list(LXC_ANSIBLE_STATES.keys()),
default='started'
),
container_command=dict(
@ -1733,7 +1733,7 @@ def main():
type='path',
),
archive_compression=dict(
choices=LXC_COMPRESSION_MAP.keys(),
choices=list(LXC_COMPRESSION_MAP.keys()),
default='gzip'
)
),

View file

@ -665,7 +665,7 @@ def main():
type='dict',
),
state=dict(
choices=LXD_ANSIBLE_STATES.keys(),
choices=list(LXD_ANSIBLE_STATES.keys()),
default='started'
),
target=dict(

View file

@ -695,15 +695,15 @@ def update_monitoring_policy(module, oneandone_conn):
threshold_entities = ['cpu', 'ram', 'disk', 'internal_ping', 'transfer']
_thresholds = []
for treshold in thresholds:
key = treshold.keys()[0]
for threshold in thresholds:
key = list(threshold.keys())[0]
if key in threshold_entities:
_threshold = oneandone.client.Threshold(
entity=key,
warning_value=treshold[key]['warning']['value'],
warning_alert=str(treshold[key]['warning']['alert']).lower(),
critical_value=treshold[key]['critical']['value'],
critical_alert=str(treshold[key]['critical']['alert']).lower())
warning_value=threshold[key]['warning']['value'],
warning_alert=str(threshold[key]['warning']['alert']).lower(),
critical_value=threshold[key]['critical']['value'],
critical_alert=str(threshold[key]['critical']['alert']).lower())
_thresholds.append(_threshold)
if name or description or email or thresholds:
@ -864,15 +864,15 @@ def create_monitoring_policy(module, oneandone_conn):
threshold_entities = ['cpu', 'ram', 'disk', 'internal_ping', 'transfer']
_thresholds = []
for treshold in thresholds:
key = treshold.keys()[0]
for threshold in thresholds:
key = list(threshold.keys())[0]
if key in threshold_entities:
_threshold = oneandone.client.Threshold(
entity=key,
warning_value=treshold[key]['warning']['value'],
warning_alert=str(treshold[key]['warning']['alert']).lower(),
critical_value=treshold[key]['critical']['value'],
critical_alert=str(treshold[key]['critical']['alert']).lower())
warning_value=threshold[key]['warning']['value'],
warning_alert=str(threshold[key]['warning']['alert']).lower(),
critical_value=threshold[key]['critical']['value'],
critical_alert=str(threshold[key]['critical']['alert']).lower())
_thresholds.append(_threshold)
_ports = []

View file

@ -128,7 +128,7 @@ def update_vcn(virtual_network_client, module):
primitive_params_update=["vcn_id"],
kwargs_non_primitive_update={UpdateVcnDetails: "update_vcn_details"},
module=module,
update_attributes=UpdateVcnDetails().attribute_map.keys(),
update_attributes=list(UpdateVcnDetails().attribute_map.keys()),
)
return result

View file

@ -1305,10 +1305,8 @@ def expand_tags(eg_launchspec, tags):
for tag in tags:
eg_tag = spotinst.aws_elastigroup.Tag()
if tag.keys():
eg_tag.tag_key = tag.keys()[0]
if tag.values():
eg_tag.tag_value = tag.values()[0]
if tag:
eg_tag.tag_key, eg_tag.tag_value = list(tag.items())[0]
eg_tags.append(eg_tag)