Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
Partially reverse commit 744564c in preparation of generic approach t…
Browse files Browse the repository at this point in the history
…o region selection

[Issue(s) #50, #53]
  • Loading branch information
sopel committed Feb 26, 2014
1 parent 108d6c4 commit 5187a87
Show file tree
Hide file tree
Showing 35 changed files with 34 additions and 36 deletions.
2 changes: 0 additions & 2 deletions botocross/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ def build_common_parser():
def build_region_parser():
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument("-r", "--region", help="A region substring selector (e.g. 'us-west')")
parser.add_argument("--include_govcloud", action='store_true', help="Include 'GovCloud' regions. [default: False]")
parser.add_argument("--only_govcloud", action='store_true', help="Return only 'GovCloud' region(s). [default: False]")
return parser

def build_filter_parser(resource_name, add_ids=True):
Expand Down
2 changes: 1 addition & 1 deletion scripts/authorize-securitygroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def authorizeIp():
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)

# execute business logic
group_name = args.name if args.name else ""
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
locations = bc.filter_regions_s3(class_iterator(Location), args.region, args.include_govcloud, args.only_govcloud)
locations = bc.filter_regions_s3(class_iterator(Location), args.region)

# execute business logic
log.info("Creating S3 buckets named '" + args.bucket + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-images.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)

# execute business logic
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-securitygroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)

# execute business logic
log.info("Creating EC2 security groups named '" + args.group + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)

# execute business logic
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region)

def processParameter(parameter, region_name, account_id):
replacement = parameter[1].replace('{REGION}', region_name).replace('{ACCOUNT}', account_id)
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.sns.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.sns.regions(), args.region)

# execute business logic
log.info("Creating SNS topics named '" + args.topic + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/delete-buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
locations = bc.filter_regions_s3(class_iterator(Location), args.region, args.include_govcloud, args.only_govcloud)
locations = bc.filter_regions_s3(class_iterator(Location), args.region)

# execute business logic
log.info("Deleting S3 buckets named '" + args.bucket + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/delete-keypairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)

# execute business logic
log.info("Deleting key pair named '" + args.key_name + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/delete-keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
locations = bc.filter_regions_s3(class_iterator(Location), args.region, args.include_govcloud, args.only_govcloud)
locations = bc.filter_regions_s3(class_iterator(Location), args.region)

# execute business logic
log.info("Deleting from S3 buckets named '" + args.bucket + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/delete-securitygroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)

# execute business logic
groupname = args.name if args.name else ""
Expand Down
2 changes: 1 addition & 1 deletion scripts/delete-snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)
log.info(args.resource_ids)

Expand Down
2 changes: 1 addition & 1 deletion scripts/delete-stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region)

# execute business logic
log.info("Deleting CloudFormation stacks named '" + args.stack_name_or_id + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/delete-topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.sns.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.sns.regions(), args.region)

def createTopicArn(region_name, topic_name):
from botocross.iam.accountinfo import AccountInfo
Expand Down
2 changes: 1 addition & 1 deletion scripts/deregister-images.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)
log.info(args.resource_ids)

Expand Down
2 changes: 1 addition & 1 deletion scripts/describe-images.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)
log.info(args.resource_ids)

Expand Down
2 changes: 1 addition & 1 deletion scripts/describe-instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)
log.info(args.resource_ids)

Expand Down
2 changes: 1 addition & 1 deletion scripts/describe-regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)

# execute business logic
log.info("Describing regions for EC2:")
Expand Down
2 changes: 1 addition & 1 deletion scripts/describe-securitygroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)

# execute business logic
Expand Down
2 changes: 1 addition & 1 deletion scripts/describe-snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)
log.info(args.resource_ids)

Expand Down
2 changes: 1 addition & 1 deletion scripts/describe-stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region)

# execute business logic
log.info("Describing CloudFormation stacks:")
Expand Down
2 changes: 1 addition & 1 deletion scripts/describe-tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filters = bc.build_filter_params(args.filter)

# execute business logic
Expand Down
2 changes: 1 addition & 1 deletion scripts/describe-volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)
log.info(args.resource_ids)

Expand Down
2 changes: 1 addition & 1 deletion scripts/expire-images.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)

# execute business logic
Expand Down
2 changes: 1 addition & 1 deletion scripts/expire-snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)
filter = bc.build_filter(args.filter, args.exclude)

# execute business logic
Expand Down
2 changes: 1 addition & 1 deletion scripts/import-keypairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)

# execute business logic
log.info("Importing key pair named '" + args.key_name + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/list-subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.sns.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.sns.regions(), args.region)

# execute business logic
log.info("Describing SNS topics:")
Expand Down
2 changes: 1 addition & 1 deletion scripts/list-topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.sns.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.sns.regions(), args.region)

# execute business logic
log.info("Describing SNS topics:")
Expand Down
2 changes: 1 addition & 1 deletion scripts/read-buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
locations = bc.filter_regions_s3(class_iterator(Location), args.region, args.include_govcloud, args.only_govcloud)
locations = bc.filter_regions_s3(class_iterator(Location), args.region)

# execute business logic
log.info("Reading S3 buckets named '" + args.bucket + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/revoke-securitygroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def revokeIp():
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.ec2.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.ec2.regions(), args.region)

# execute business logic
group_name = args.name if args.name else ""
Expand Down
2 changes: 1 addition & 1 deletion scripts/subscribe-topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.sns.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.sns.regions(), args.region)

# execute business logic
log.info("Subscribing to SNS topics named '" + args.topic + ' with protocol ' + args.protocol + ' and endpoint ' + args.endpoint + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region)

def processParameter(parameter, region_name, account_id):
replacement = parameter[1].replace('{REGION}', region_name).replace('{ACCOUNT}', account_id)
Expand Down
2 changes: 1 addition & 1 deletion scripts/upload-keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
locations = bc.filter_regions_s3(class_iterator(Location), args.region, args.include_govcloud, args.only_govcloud)
locations = bc.filter_regions_s3(class_iterator(Location), args.region)

# execute business logic
log.info("Uploading to S3 buckets named '" + args.bucket + "':")
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate-template.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
log = logging.getLogger('botocross')
bc.configure_logging(log, args.log_level)
credentials = bc.parse_credentials(args)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region, args.include_govcloud, args.only_govcloud)
regions = bc.filter_regions(boto.cloudformation.regions(), args.region)

def processArgument(argument, region_name):
return argument.replace('{REGION}', region_name)
Expand Down

0 comments on commit 5187a87

Please sign in to comment.