Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit eb0d5a1

Browse files
author
Andy Henroid
committed
Merge branch 'avoid-region-clash-between-env-and-property' of https://github.com/garethr/puppetlabs-aws into garethr-avoid-region-clash-between-env-and-property
2 parents 495d124 + 919073e commit eb0d5a1

17 files changed

+62
-88
lines changed

lib/puppet/type/cloudwatch_alarm.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require_relative '../../puppet_x/puppetlabs/property/region'
2+
13
Puppet::Type.newtype(:cloudwatch_alarm) do
24
@doc = 'Type representing an AWS CloudWatch Alarm.'
35

@@ -73,13 +75,8 @@
7375
end
7476
end
7577

76-
newproperty(:region) do
78+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
7779
desc 'The region in which to launch the instances.'
78-
validate do |value|
79-
fail 'region should not contain spaces' if value =~ /\s/
80-
fail 'region should not be blank' if value == ''
81-
fail 'region should be a String' unless value.is_a?(String)
82-
end
8380
end
8481

8582
newproperty(:dimensions, :array_matching => :all) do

lib/puppet/type/ec2_autoscalinggroup.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require_relative '../../puppet_x/puppetlabs/property/tag.rb'
2+
require_relative '../../puppet_x/puppetlabs/property/region'
23
require 'puppet/property/boolean'
34

45
Puppet::Type.newtype(:ec2_autoscalinggroup) do
@@ -87,13 +88,8 @@
8788
desc 'Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in.'
8889
end
8990

90-
newproperty(:region) do
91+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
9192
desc 'The region in which to launch the instances.'
92-
validate do |value|
93-
fail 'region should not contain spaces' if value =~ /\s/
94-
fail 'region should not be blank' if value == ''
95-
fail 'region should be a String' unless value.is_a?(String)
96-
end
9793
end
9894

9995
newproperty(:launch_configuration) do

lib/puppet/type/ec2_elastic_ip.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require_relative '../../puppet_x/puppetlabs/property/region'
2+
13
Puppet::Type.newtype(:ec2_elastic_ip) do
24
@doc = "Type representing an Elastic IP and it's association."
35

@@ -19,12 +21,8 @@
1921
end
2022
end
2123

22-
newproperty(:region) do
24+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
2325
desc 'The name of the region in which the Elastic IP is found.'
24-
validate do |value|
25-
fail 'region should be a String' unless value.is_a?(String)
26-
fail 'You must provide a region for Elastic IPs.' if value.nil? || value.empty?
27-
end
2826
end
2927

3028
newproperty(:instance) do

lib/puppet/type/ec2_launchconfiguration.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require_relative '../../puppet_x/puppetlabs/property/region'
2+
13
Puppet::Type.newtype(:ec2_launchconfiguration) do
24
@doc = 'Type representing an EC2 launch configuration.'
35

@@ -33,13 +35,8 @@ def insync?(is)
3335
end
3436
end
3537

36-
newproperty(:region) do
38+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
3739
desc 'The region in which to launch the instances.'
38-
validate do |value|
39-
fail 'region should not contain spaces' if value =~ /\s/
40-
fail 'region should not be blank' if value == ''
41-
fail 'region should be a String' unless value.is_a?(String)
42-
end
4340
end
4441

4542
newproperty(:instance_type) do

lib/puppet/type/ec2_scalingpolicy.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require_relative '../../puppet_x/puppetlabs/property/region'
2+
13
Puppet::Type.newtype(:ec2_scalingpolicy) do
24
@doc = 'Type representing an EC2 scaling policy.'
35

@@ -21,13 +23,8 @@
2123
end
2224
end
2325

24-
newproperty(:region) do
26+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
2527
desc 'The region in which to launch the policy.'
26-
validate do |value|
27-
fail 'region should not contain spaces' if value =~ /\s/
28-
fail 'region should not be blank' if value == ''
29-
fail 'region should be a String' unless value.is_a?(String)
30-
end
3128
end
3229

3330
newproperty(:adjustment_type) do

lib/puppet/type/ec2_securitygroup.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require_relative '../../puppet_x/puppetlabs/property/tag.rb'
1+
require_relative '../../puppet_x/puppetlabs/property/tag'
2+
require_relative '../../puppet_x/puppetlabs/property/region'
23
require_relative '../../puppet_x/puppetlabs/aws_ingress_rules_parser'
34

45
Puppet::Type.newtype(:ec2_securitygroup) do
@@ -14,12 +15,8 @@
1415
end
1516
end
1617

17-
newproperty(:region) do
18+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
1819
desc 'the region in which to launch the security group'
19-
validate do |value|
20-
fail 'region should not contain spaces' if value =~ /\s/
21-
fail 'region should be a String' unless value.is_a?(String)
22-
end
2320
end
2421

2522
newproperty(:ingress, :array_matching => :all) do

lib/puppet/type/ec2_vpc.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require_relative '../../puppet_x/puppetlabs/property/tag.rb'
1+
require_relative '../../puppet_x/puppetlabs/property/tag'
2+
require_relative '../../puppet_x/puppetlabs/property/region'
23

34
Puppet::Type.newtype(:ec2_vpc) do
45
@doc = 'A type representing an AWS VPC.'
@@ -13,12 +14,8 @@
1314
end
1415
end
1516

16-
newproperty(:region) do
17+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
1718
desc 'The region in which to launch the VPC.'
18-
validate do |value|
19-
fail 'region should not contain spaces' if value =~ /\s/
20-
fail 'region should be a String' unless value.is_a?(String)
21-
end
2219
end
2320

2421
newproperty(:cidr_block) do

lib/puppet/type/ec2_vpc_customer_gateway.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require_relative '../../puppet_x/puppetlabs/property/tag.rb'
1+
require_relative '../../puppet_x/puppetlabs/property/tag'
2+
require_relative '../../puppet_x/puppetlabs/property/region'
23

34
Puppet::Type.newtype(:ec2_vpc_customer_gateway) do
45
@doc = 'Type representing an AWS VPC customer gateways.'
@@ -31,12 +32,8 @@
3132
desc 'The tags for the customer gateway.'
3233
end
3334

34-
newproperty(:region) do
35+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
3536
desc 'The region in which to launch the customer gateway.'
36-
validate do |value|
37-
fail 'region should not contain spaces' if value =~ /\s/
38-
fail 'region should be a String' unless value.is_a?(String)
39-
end
4037
end
4138

4239
newproperty(:type) do

lib/puppet/type/ec2_vpc_dhcp_options.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require_relative '../../puppet_x/puppetlabs/property/tag.rb'
1+
require_relative '../../puppet_x/puppetlabs/property/tag'
2+
require_relative '../../puppet_x/puppetlabs/property/region'
23

34
Puppet::Type.newtype(:ec2_vpc_dhcp_options) do
45
@doc = 'Type representing a DHCP option set for AWS VPC.'
@@ -17,7 +18,7 @@
1718
desc 'Tags for the DHCP option set.'
1819
end
1920

20-
newproperty(:region) do
21+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
2122
desc 'The region in which to assign the DHCP option set.'
2223
validate do |value|
2324
fail 'region should not contain spaces' if value =~ /\s/

lib/puppet/type/ec2_vpc_internet_gateway.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require_relative '../../puppet_x/puppetlabs/property/tag.rb'
1+
require_relative '../../puppet_x/puppetlabs/property/tag'
2+
require_relative '../../puppet_x/puppetlabs/property/region'
23

34
Puppet::Type.newtype(:ec2_vpc_internet_gateway) do
45
@doc = 'Type representing an EC2 VPC Internet Gateway.'
@@ -17,12 +18,8 @@
1718
desc 'Tags to assign to the internet gateway.'
1819
end
1920

20-
newproperty(:region) do
21+
newproperty(:region, :parent => PuppetX::Property::AwsRegion) do
2122
desc 'The region in which to launch the internet gateway.'
22-
validate do |value|
23-
fail 'region should not contain spaces' if value =~ /\s/
24-
fail 'region should be a String' unless value.is_a?(String)
25-
end
2623
end
2724

2825
newproperty(:vpc) do

0 commit comments

Comments
 (0)