mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
PEP 8 E111 & E114 cleanup. (#20838)
This commit is contained in:
@@ -43,7 +43,7 @@ def delete_autoscaling_group(get_func, attr, opts):
|
||||
if tmp_groups:
|
||||
tmp_group = tmp_groups[0]
|
||||
if not tmp_group.instances:
|
||||
instances = False
|
||||
instances = False
|
||||
time.sleep(10)
|
||||
|
||||
group.delete()
|
||||
@@ -55,15 +55,15 @@ def delete_aws_eips(get_func, attr, opts):
|
||||
|
||||
# the file might not be there if the integration test wasn't run
|
||||
try:
|
||||
eip_log = open(opts.eip_log, 'r').read().splitlines()
|
||||
eip_log = open(opts.eip_log, 'r').read().splitlines()
|
||||
except IOError:
|
||||
print('%s not found.' % opts.eip_log)
|
||||
return
|
||||
print('%s not found.' % opts.eip_log)
|
||||
return
|
||||
|
||||
for item in get_func():
|
||||
val = getattr(item, attr)
|
||||
if val in eip_log:
|
||||
prompt_and_delete(item, "Delete matching %s? [y/n]: " % (item,), opts.assumeyes)
|
||||
prompt_and_delete(item, "Delete matching %s? [y/n]: " % (item,), opts.assumeyes)
|
||||
|
||||
def delete_aws_instances(reservation, opts):
|
||||
for list in reservation:
|
||||
|
||||
@@ -63,15 +63,15 @@ if __name__ == '__main__':
|
||||
gce = gce_credentials.get_gce_driver(opts)
|
||||
|
||||
try:
|
||||
# Delete matching instances
|
||||
delete_gce_resources(gce.list_nodes, 'name', opts)
|
||||
# Delete matching snapshots
|
||||
def get_snapshots():
|
||||
for volume in gce.list_volumes():
|
||||
for snapshot in gce.list_volume_snapshots(volume):
|
||||
yield snapshot
|
||||
delete_gce_resources(get_snapshots, 'name', opts)
|
||||
# Delete matching disks
|
||||
delete_gce_resources(gce.list_volumes, 'name', opts)
|
||||
# Delete matching instances
|
||||
delete_gce_resources(gce.list_nodes, 'name', opts)
|
||||
# Delete matching snapshots
|
||||
def get_snapshots():
|
||||
for volume in gce.list_volumes():
|
||||
for snapshot in gce.list_volume_snapshots(volume):
|
||||
yield snapshot
|
||||
delete_gce_resources(get_snapshots, 'name', opts)
|
||||
# Delete matching disks
|
||||
delete_gce_resources(gce.list_volumes, 'name', opts)
|
||||
except KeyboardInterrupt as e:
|
||||
print("\nExiting on user command.")
|
||||
|
||||
@@ -24,7 +24,7 @@ def parse_args():
|
||||
(opts, args) = parser.parse_args()
|
||||
gce_credentials.check_required(opts, parser)
|
||||
if not args:
|
||||
parser.error("Missing required argument: name prefix")
|
||||
parser.error("Missing required argument: name prefix")
|
||||
return (opts, args)
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -33,10 +33,10 @@ if __name__ == '__main__':
|
||||
gce = gce_credentials.get_gce_driver(opts)
|
||||
prefix = args[0].lower()
|
||||
try:
|
||||
base_volume = gce.create_volume(
|
||||
size=10, name=prefix+'-base', location='us-central1-a')
|
||||
gce.create_volume_snapshot(base_volume, name=prefix+'-snapshot')
|
||||
gce.create_volume(
|
||||
size=10, name=prefix+'-extra', location='us-central1-a')
|
||||
base_volume = gce.create_volume(
|
||||
size=10, name=prefix+'-base', location='us-central1-a')
|
||||
gce.create_volume_snapshot(base_volume, name=prefix+'-snapshot')
|
||||
gce.create_volume(
|
||||
size=10, name=prefix+'-extra', location='us-central1-a')
|
||||
except KeyboardInterrupt as e:
|
||||
print("\nExiting on user command.")
|
||||
|
||||
Reference in New Issue
Block a user