mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Fix undefined variables, basestring usage, and some associated python3 issues
This commit is contained in:
@@ -14,6 +14,8 @@ import sys
|
||||
import time
|
||||
import yaml
|
||||
|
||||
from ansible.module_utils.six.moves import input
|
||||
|
||||
|
||||
def delete_aws_resources(get_func, attr, opts):
|
||||
for item in get_func():
|
||||
@@ -29,7 +31,7 @@ def delete_autoscaling_group(get_func, attr, opts):
|
||||
group_name = getattr(item, attr)
|
||||
if re.search(opts.match_re, group_name):
|
||||
if not opts.assumeyes:
|
||||
assumeyes = raw_input("Delete matching %s? [y/n]: " % (item).lower()) == 'y'
|
||||
assumeyes = input("Delete matching %s? [y/n]: " % (item).lower()) == 'y'
|
||||
break
|
||||
if assumeyes and group_name:
|
||||
groups = asg.get_all_groups(names=[group_name])
|
||||
@@ -77,7 +79,7 @@ def delete_aws_instances(reservation, opts):
|
||||
|
||||
def prompt_and_delete(item, prompt, assumeyes):
|
||||
if not assumeyes:
|
||||
assumeyes = raw_input(prompt).lower() == 'y'
|
||||
assumeyes = input(prompt).lower() == 'y'
|
||||
assert hasattr(item, 'delete') or hasattr(item, 'terminate'), "Class <%s> has no delete or terminate attribute" % item.__class__
|
||||
if assumeyes:
|
||||
if hasattr(item, 'delete'):
|
||||
|
||||
@@ -27,6 +27,8 @@ except ImportError:
|
||||
|
||||
import gce_credentials
|
||||
|
||||
from ansible.module_utils.six.moves import input
|
||||
|
||||
|
||||
def delete_gce_resources(get_func, attr, opts):
|
||||
for item in get_func():
|
||||
@@ -37,7 +39,7 @@ def delete_gce_resources(get_func, attr, opts):
|
||||
|
||||
def prompt_and_delete(item, prompt, assumeyes):
|
||||
if not assumeyes:
|
||||
assumeyes = raw_input(prompt).lower() == 'y'
|
||||
assumeyes = input(prompt).lower() == 'y'
|
||||
assert hasattr(item, 'destroy'), "Class <%s> has no delete attribute" % item.__class__
|
||||
if assumeyes:
|
||||
item.destroy()
|
||||
|
||||
@@ -11,6 +11,8 @@ try:
|
||||
except ImportError:
|
||||
HAS_PYRAX = False
|
||||
|
||||
from ansible.module_utils.six.moves import input
|
||||
|
||||
|
||||
def rax_list_iterator(svc, *args, **kwargs):
|
||||
method = kwargs.pop('method', 'list')
|
||||
@@ -53,7 +55,7 @@ def authenticate():
|
||||
|
||||
def prompt_and_delete(item, prompt, assumeyes):
|
||||
if not assumeyes:
|
||||
assumeyes = raw_input(prompt).lower() == 'y'
|
||||
assumeyes = input(prompt).lower() == 'y'
|
||||
assert hasattr(item, 'delete') or hasattr(item, 'terminate'), \
|
||||
"Class <%s> has no delete or terminate attribute" % item.__class__
|
||||
if assumeyes:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Most of these names are only available via PluginLoader so pylint doesn't
|
||||
# know they exist
|
||||
# pylint: disable=no-name-in-module
|
||||
results = {}
|
||||
|
||||
# Test import with no from
|
||||
|
||||
Reference in New Issue
Block a user