miam 0.2.4.beta16 → 0.2.4.beta17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 3064e06a5f31e8841828996c7669ba0ec6a9243b0480581d6f406722d64d002d
4
- data.tar.gz: 03e24693e97410030cd8541a391972de9567d82d8cfa45a3f6d2f915c5c5cb7c
2
+ SHA1:
3
+ metadata.gz: 4c056ab62187e7e83c09f4d831ade33d027a17a5
4
+ data.tar.gz: f2624cffa5e89e52ad85a0c25e112de8ea290a27
5
5
  SHA512:
6
- metadata.gz: 35398120cf54254e14b890bddefc62236e6051d78b82abbabddbe62c6286ba492de26250c94bd6e1197894ae1447dd70cf226880796144c82e064da724f912a9
7
- data.tar.gz: 5c4399f1ab0ab49e85c7cb65e93f44d9895a616e5eb93e7e041f371b31f1ff06e4075929f262a14a70ac280d78d1e69fed2effb5a911f7c2d6650f90a657a1a3
6
+ metadata.gz: c5826b80983bf1add3de03ea6aa225b8e9a4df2aea09a71840f4761b36d160cc2783d0d336bbf93c188f12189f51b8471e300752a19fcc00ac6f08ab8420fc72
7
+ data.tar.gz: a15d014e2ba67c0239d5035cad1f233142ad8b92f63996c6869540c8b895c2574667b483bb7efa0cc003972150f721b8eb4cd35565257aca33308d7dca976aa2
@@ -2,7 +2,10 @@ class Miam::Client
2
2
  include Miam::Logger::Helper
3
3
 
4
4
  def initialize(options = {})
5
- @options = {:format => :ruby}.merge(options)
5
+ @options = {
6
+ format: :ruby,
7
+ exclude: []
8
+ }.merge(options)
6
9
  aws_config = options.delete(:aws_config) || {}
7
10
  @iam = Aws::IAM::Client.new(aws_config)
8
11
  @sts = Aws::STS::Client.new(aws_config)
@@ -58,6 +61,7 @@ class Miam::Client
58
61
 
59
62
  def walk(file)
60
63
  expected = load_file(file)
64
+ @options[:exclude] += expected[:exclude]
61
65
 
62
66
  actual, group_users, instance_profile_roles = Miam::Exporter.export(@iam, @options)
63
67
  updated = pre_walk_managed_policies(expected[:policies], actual[:policies])
@@ -539,7 +543,7 @@ class Miam::Client
539
543
  result = true
540
544
 
541
545
  if @options[:exclude]
542
- result &&= @options[:exclude].all? {|r| name !~ r}
546
+ result &&= @options[:exclude].all? {|r| name !~ r }
543
547
  end
544
548
 
545
549
  if @options[:target]
@@ -12,7 +12,7 @@ class Miam::DSL::Context
12
12
  def initialize(path, options = {}, &block)
13
13
  @path = path
14
14
  @options = options
15
- @result = {:users => {}, :groups => {}, :roles => {}, :instance_profiles => {}, :policies => {}}
15
+ @result = {:users => {}, :groups => {}, :roles => {}, :instance_profiles => {}, :policies => {}, :exclude => []}
16
16
 
17
17
  @context = Hashie::Mash.new(
18
18
  :path => path,
@@ -41,6 +41,10 @@ class Miam::DSL::Context
41
41
  end
42
42
  end
43
43
 
44
+ def exclude(pattern)
45
+ @result[:exclude] << pattern
46
+ end
47
+
44
48
  def user(name, user_options = {}, &block)
45
49
  name = name.to_s
46
50
 
@@ -1,3 +1,3 @@
1
1
  module Miam
2
- VERSION = '0.2.4.beta16'
2
+ VERSION = '0.2.4.beta17'
3
3
  end
@@ -234,4 +234,19 @@ describe 'exclude option' do
234
234
  expect(updated).to be_falsey
235
235
  end
236
236
  end
237
+
238
+ context 'when specifying exclude option in a DSL' do
239
+ let(:exclude_everything) do
240
+ <<-RUBY
241
+ exclude /.*/
242
+ RUBY
243
+ end
244
+
245
+ subject { client(exclude: []) }
246
+
247
+ it do
248
+ updated = apply(subject) { exclude_everything }
249
+ expect(updated).to be_falsey
250
+ end
251
+ end
237
252
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4.beta16
4
+ version: 0.2.4.beta17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-02 00:00:00.000000000 Z
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  version: 1.3.1
252
252
  requirements: []
253
253
  rubyforge_project:
254
- rubygems_version: 2.7.3
254
+ rubygems_version: 2.6.14.1
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: Miam is a tool to manage IAM.