piculet 0.2.6 → 0.2.7.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3746bec51eeb9809fced50bd28a1d855fca9a57c
4
- data.tar.gz: 89da5f8f15a27ff91a3f2f77b2cabc37237b6941
3
+ metadata.gz: 7d9cafe5310dd7b6df5016c66c85dfc47f9a04c1
4
+ data.tar.gz: a261ba1ff4378fdf62dd876b90f57c71a0d56689
5
5
  SHA512:
6
- metadata.gz: c6eb3eb1da6212073d27fdb4b9eb7c5fab351046d1fb2c70327d0df6b5d1c1b92213257e06a26f8c1a58654255cacd3aa8e9329162e601683ea6ef0422b4f893
7
- data.tar.gz: 2ec0377fe861a5447b385c412e0f7ce6d040c6475be06099e250874fede57807a1e8a0cfe01023c53bd32d7436aa30c6675cec9631344a2fff463175c4ad07f2
6
+ metadata.gz: f1f778f163c7d3da3b924d9f9e313ca925b27d3967bd39549f2e405518067ea8681f43ef3cf3440f7ef1bfeeece5d1c8cb1c76d7276d22140d13ccbd4de0da19
7
+ data.tar.gz: 44f11549930395ba2ab2b28bbd035be43c1589b45ccf7b4369129ec96202cf555bcdd692b8e0f4b8581551fbd342b962f9661bea0975a3f0d899141f18807676
data/README.md CHANGED
@@ -47,6 +47,7 @@ Usage: piculet [options]
47
47
  -a, --apply
48
48
  -f, --file FILE
49
49
  -n, --names SG_LIST
50
+ -x, --exclude SG_LIST
50
51
  --ec2s VPC_IDS
51
52
  --dry-run
52
53
  -e, --export
data/bin/piculet CHANGED
@@ -29,21 +29,22 @@ ARGV.options do |opt|
29
29
  profile_name = nil
30
30
  credentials_path = nil
31
31
 
32
- opt.on('-p', '--profile PROFILE_NAME') {|v| profile_name = v }
33
- opt.on('' , '--credentials-path PATH') {|v| credentials_path = v }
34
- opt.on('-k', '--access-key ACCESS_KEY') {|v| access_key = v }
35
- opt.on('-s', '--secret-key SECRET_KEY') {|v| secret_key = v }
36
- opt.on('-r', '--region REGION') {|v| region = v }
37
- opt.on('-a', '--apply') {|v| mode = :apply }
38
- opt.on('-f', '--file FILE') {|v| file = v }
39
- opt.on('-n', '--names SG_LIST', Array) {|v| options[:sg_names] = v }
40
- opt.on('', '--ec2s VPC_IDS', Array) {|v| options[:ec2s] = v }
41
- opt.on('', '--dry-run') {|v| options[:dry_run] = true }
42
- opt.on('-e', '--export') {|v| mode = :export }
43
- opt.on('-o', '--output FILE') {|v| output_file = v }
44
- opt.on('', '--split') {|v| split = true }
45
- opt.on('' , '--no-color') { options[:color] = false }
46
- opt.on('' , '--debug') { options[:debug] = true }
32
+ opt.on('-p', '--profile PROFILE_NAME') {|v| profile_name = v }
33
+ opt.on('' , '--credentials-path PATH') {|v| credentials_path = v }
34
+ opt.on('-k', '--access-key ACCESS_KEY') {|v| access_key = v }
35
+ opt.on('-s', '--secret-key SECRET_KEY') {|v| secret_key = v }
36
+ opt.on('-r', '--region REGION') {|v| region = v }
37
+ opt.on('-a', '--apply') {|v| mode = :apply }
38
+ opt.on('-f', '--file FILE') {|v| file = v }
39
+ opt.on('-n', '--names SG_LIST', Array) {|v| options[:sg_names] = v }
40
+ opt.on('-x', '--exclude SG_LIST', Array) {|v| options[:exclude_sgs] = v }
41
+ opt.on('', '--ec2s VPC_IDS', Array) {|v| options[:ec2s] = v }
42
+ opt.on('', '--dry-run') {|v| options[:dry_run] = true }
43
+ opt.on('-e', '--export') {|v| mode = :export }
44
+ opt.on('-o', '--output FILE') {|v| output_file = v }
45
+ opt.on('', '--split') {|v| split = true }
46
+ opt.on('' , '--no-color') { options[:color] = false }
47
+ opt.on('' , '--debug') { options[:debug] = true }
47
48
  opt.parse!
48
49
 
49
50
  aws_opts = {}
@@ -65,6 +66,14 @@ ARGV.options do |opt|
65
66
 
66
67
  aws_opts[:region] = region if region
67
68
  AWS.config(aws_opts)
69
+
70
+ # Remap groups to exclude to regular expressions (if they're surrounded by '/')
71
+ if options[:exclude_sgs]
72
+ options[:exclude_sgs].map! do |name|
73
+ name =~ /\A\/(.*)\/\z/ ? Regexp.new($1) : Regexp.new("\A#{Regexp.escape(name)}\z")
74
+ end
75
+ end
76
+
68
77
  rescue => e
69
78
  $stderr.puts("[ERROR] #{e.message}")
70
79
  exit 1
@@ -80,6 +80,10 @@ module Piculet
80
80
  next unless @options.sg_names.include?(name)
81
81
  end
82
82
 
83
+ if @options.exclude_sgs
84
+ next if @options.exclude_sgs.any? {|regex| name =~ regex}
85
+ end
86
+
83
87
  sg_aws = sg_list_aws[key]
84
88
 
85
89
  unless sg_aws
@@ -100,6 +104,10 @@ module Piculet
100
104
  next unless @options.sg_names.include?(name)
101
105
  end
102
106
 
107
+ if @options.exclude_sgs
108
+ next if @options.exclude_sgs.any? {|regex| name =~ regex}
109
+ end
110
+
103
111
  sg_aws = sg_list_aws.delete(key)
104
112
  walk_security_group(sg_dsl, sg_aws)
105
113
  end
@@ -111,6 +119,10 @@ module Piculet
111
119
  next unless @options.sg_names.include?(name)
112
120
  end
113
121
 
122
+ if @options.exclude_sgs
123
+ next if @options.exclude_sgs.any? {|regex| name =~ regex}
124
+ end
125
+
114
126
  sg_aws.ingress_ip_permissions.each {|i| i.delete }
115
127
  sg_aws.egress_ip_permissions.each {|i| i.delete } if vpc
116
128
  end
@@ -122,6 +134,10 @@ module Piculet
122
134
  next unless @options.sg_names.include?(name)
123
135
  end
124
136
 
137
+ if @options.exclude_sgs
138
+ next if @options.exclude_sgs.any? {|regex| name =~ regex}
139
+ end
140
+
125
141
  sg_aws.delete
126
142
  end
127
143
  end
@@ -1,3 +1,3 @@
1
1
  module Piculet
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7.beta"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piculet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-14 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -146,9 +146,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
146
  version: '0'
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - '>='
149
+ - - '>'
150
150
  - !ruby/object:Gem::Version
151
- version: '0'
151
+ version: 1.3.1
152
152
  requirements: []
153
153
  rubyforge_project:
154
154
  rubygems_version: 2.0.14