From 155c9ff6c9b5be7f38fbd988b1132b9387baf3c2 Mon Sep 17 00:00:00 2001 From: whiter Date: Mon, 29 Jun 2015 11:18:04 +1000 Subject: [PATCH 1/4] Fixed incorrect connect_to_aws call - switched to boto.vpc instead of boto.ec2 --- cloud/amazon/ec2_vpc_igw.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/cloud/amazon/ec2_vpc_igw.py b/cloud/amazon/ec2_vpc_igw.py index 63be48248ef..499171ede54 100644 --- a/cloud/amazon/ec2_vpc_igw.py +++ b/cloud/amazon/ec2_vpc_igw.py @@ -20,18 +20,25 @@ short_description: Manage an AWS VPC Internet gateway description: - Manage an AWS VPC Internet gateway version_added: "2.0" -author: Robert Estelle, @erydo +author: Robert Estelle (@erydo) options: vpc_id: description: - The VPC ID for the VPC in which to manage the Internet Gateway. required: true default: null + region: + description: + - The AWS region to use. Must be specified if ec2_url is not used. If not specified then the value of the EC2_REGION environment variable, if any, is used. See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region) + required: false + default: null + aliases: [ 'aws_region', 'ec2_region' ] state: description: - Create or terminate the IGW required: false default: present + choices: [ 'present', 'absent' ] extends_documentation_fragment: aws ''' @@ -39,16 +46,13 @@ EXAMPLES = ''' # Note: These examples do not set authentication details, see the AWS Guide for details. # Ensure that the VPC has an Internet Gateway. -# The Internet Gateway ID is can be accessed via {{igw.gateway_id}} for use -# in setting up NATs etc. - local_action: - module: ec2_vpc_igw - vpc_id: {{vpc.vpc_id}} - region: {{vpc.vpc.region}} - state: present - register: igw -''' +# The Internet Gateway ID is can be accessed via {{igw.gateway_id}} for use in setting up NATs etc. +module: ec2_vpc_igw + vpc_id: vpc-abcdefgh + state: present +register: igw +''' import sys # noqa @@ -116,8 +120,8 @@ def main(): argument_spec = ec2_argument_spec() argument_spec.update( dict( - vpc_id = dict(required=True), - state = dict(choices=['present', 'absent'], default='present') + vpc_id = dict(required=True, default=None), + state = dict(required=False, default='present', choices=['present', 'absent']) ) ) @@ -133,14 +137,14 @@ def main(): if region: try: - connection = connect_to_aws(boto.ec2, region, **aws_connect_params) + connection = connect_to_aws(boto.vpc, region, **aws_connect_params) except (boto.exception.NoAuthHandlerFound, StandardError), e: module.fail_json(msg=str(e)) else: module.fail_json(msg="region must be specified") vpc_id = module.params.get('vpc_id') - state = module.params.get('state', 'present') + state = module.params.get('state') try: if state == 'present': From 556e95379ed57f383658e106382ca482aab9e587 Mon Sep 17 00:00:00 2001 From: Rob White Date: Mon, 29 Jun 2015 20:53:40 +1000 Subject: [PATCH 2/4] Doc fix up --- cloud/amazon/ec2_vpc_igw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloud/amazon/ec2_vpc_igw.py b/cloud/amazon/ec2_vpc_igw.py index 499171ede54..71c2519dc4e 100644 --- a/cloud/amazon/ec2_vpc_igw.py +++ b/cloud/amazon/ec2_vpc_igw.py @@ -29,7 +29,7 @@ options: default: null region: description: - - The AWS region to use. Must be specified if ec2_url is not used. If not specified then the value of the EC2_REGION environment variable, if any, is used. See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region) + - The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used. See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region) required: false default: null aliases: [ 'aws_region', 'ec2_region' ] @@ -47,7 +47,7 @@ EXAMPLES = ''' # Ensure that the VPC has an Internet Gateway. # The Internet Gateway ID is can be accessed via {{igw.gateway_id}} for use in setting up NATs etc. -module: ec2_vpc_igw +ec2_vpc_igw: vpc_id: vpc-abcdefgh state: present register: igw From 6a3cf6335172adc94cda8588930e4760b471551d Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sat, 5 Sep 2015 08:55:34 -0700 Subject: [PATCH 3/4] correct documentation formatting --- cloud/amazon/s3_bucket.py | 2 +- cloud/amazon/s3_lifecycle.py | 14 +++++++------- cloud/vmware/vmware_target_canonical_facts.py | 4 ++-- windows/win_package.py | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cloud/amazon/s3_bucket.py b/cloud/amazon/s3_bucket.py index 8e660283472..cc0442eccc1 100644 --- a/cloud/amazon/s3_bucket.py +++ b/cloud/amazon/s3_bucket.py @@ -40,7 +40,7 @@ options: default: null region: description: - - AWS region to create the bucket in. If not set then the value of the AWS_REGION and EC2_REGION environment variables are checked, followed by the aws_region and ec2_region settings in the Boto config file. If none of those are set the region defaults to the S3 Location: US Standard. + - "AWS region to create the bucket in. If not set then the value of the AWS_REGION and EC2_REGION environment variables are checked, followed by the aws_region and ec2_region settings in the Boto config file. If none of those are set the region defaults to the S3 Location: US Standard." required: false default: null s3_url: diff --git a/cloud/amazon/s3_lifecycle.py b/cloud/amazon/s3_lifecycle.py index 3328a33f15f..7a54365c8bd 100644 --- a/cloud/amazon/s3_lifecycle.py +++ b/cloud/amazon/s3_lifecycle.py @@ -20,7 +20,7 @@ short_description: Manage s3 bucket lifecycle rules in AWS description: - Manage s3 bucket lifecycle rules in AWS version_added: "2.0" -author: Rob White (@wimnat) +author: "Rob White (@wimnat)" notes: - If specifying expiration time as days then transition time must also be specified in days - If specifying expiration time as a date then transition time must also be specified as a date @@ -35,7 +35,7 @@ options: description: - "Indicates the lifetime of the objects that are subject to the rule by the date they will expire. The value must be ISO-8601 format, the time must be midnight and a GMT timezone must be specified." required: false - default: null + default: null expiration_days: description: - "Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer." @@ -43,9 +43,9 @@ options: default: null prefix: description: - - "Prefix identifying one or more objects to which the rule applies. If no prefix is specified, the rule will apply to the whole bucket." - required: false - default: null + - "Prefix identifying one or more objects to which the rule applies. If no prefix is specified, the rule will apply to the whole bucket." + required: false + default: null region: description: - "AWS region to create the bucket in. If not set then the value of the AWS_REGION and EC2_REGION environment variables are checked, followed by the aws_region and ec2_region settings in the Boto config file. If none of those are set the region defaults to the S3 Location: US Standard." @@ -54,8 +54,8 @@ options: rule_id: description: - "Unique identifier for the rule. The value cannot be longer than 255 characters. A unique value for the rule will be generated if no value is provided." - required: false - default: null + required: false + default: null state: description: - "Create or remove the lifecycle rule" diff --git a/cloud/vmware/vmware_target_canonical_facts.py b/cloud/vmware/vmware_target_canonical_facts.py index 987b4a98753..028fc8c83a2 100644 --- a/cloud/vmware/vmware_target_canonical_facts.py +++ b/cloud/vmware/vmware_target_canonical_facts.py @@ -24,14 +24,14 @@ module: vmware_target_canonical_facts short_description: Return canonical (NAA) from an ESXi host description: - Return canonical (NAA) from an ESXi host based on SCSI target ID -version_added: 2.0 +version_added: "2.0" author: Joseph Callen notes: requirements: - Tested on vSphere 5.5 - PyVmomi installed options: - hostname: + hostname: description: - The hostname or IP address of the vSphere vCenter required: True diff --git a/windows/win_package.py b/windows/win_package.py index 3072dbed3de..d20e5ee8816 100644 --- a/windows/win_package.py +++ b/windows/win_package.py @@ -44,7 +44,7 @@ options: product_id: description: - product id of the installed package (used for checking if already installed) - required: false + required: false default: null aliases: [] arguments: @@ -54,20 +54,20 @@ options: aliases: [] state: description: - - Install or Uninstall - choices: + - Install or Uninstall + choices: - present - absent default: present aliases: [ensure] user_name: description: - - Username of an account with access to the package if its located on a file share. Only needed if the winrm user doesn't have access to the package. Also specify user_password for this to function properly. + - Username of an account with access to the package if its located on a file share. Only needed if the winrm user doesn't have access to the package. Also specify user_password for this to function properly. default: null aliases: [] user_password: description: - - Password of an account with access to the package if its located on a file share. Only needed if the winrm user doesn't have access to the package. Also specify user_name for this to function properly. + - Password of an account with access to the package if its located on a file share. Only needed if the winrm user doesn't have access to the package. Also specify user_name for this to function properly. default: null aliases: [] author: Trond Hindenes From a55dbb717cfd1a73062e952623e1009b4ef669a7 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sun, 6 Sep 2015 07:56:58 -0700 Subject: [PATCH 4/4] Try to revert the pieces of #651 that @willthames and @erydo requested --- cloud/amazon/ec2_vpc_igw.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cloud/amazon/ec2_vpc_igw.py b/cloud/amazon/ec2_vpc_igw.py index 71c2519dc4e..e374580433a 100644 --- a/cloud/amazon/ec2_vpc_igw.py +++ b/cloud/amazon/ec2_vpc_igw.py @@ -120,8 +120,8 @@ def main(): argument_spec = ec2_argument_spec() argument_spec.update( dict( - vpc_id = dict(required=True, default=None), - state = dict(required=False, default='present', choices=['present', 'absent']) + vpc_id = dict(required=True), + state = dict(default='present', choices=['present', 'absent']) ) ) @@ -144,7 +144,7 @@ def main(): module.fail_json(msg="region must be specified") vpc_id = module.params.get('vpc_id') - state = module.params.get('state') + state = module.params.get('state', 'present') try: if state == 'present':