Fix undefined variables, basestring usage, and some associated python3 issues

This commit is contained in:
Toshio Kuratomi
2017-07-22 18:15:46 -07:00
parent 9f7b0dfc30
commit 225fa5d092
84 changed files with 652 additions and 963 deletions

View File

@@ -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'):

View File

@@ -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()

View File

@@ -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:

View File

@@ -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