Browse Source

fix tag audit

Chris Mague 6 năm trước cách đây
mục cha
commit
68c1affa71
2 tập tin đã thay đổi với 9 bổ sung8 xóa
  1. 7 7
      config.yaml.example
  2. 2 1
      lib/neoinfra/audit.rb

+ 7 - 7
config.yaml.example

@@ -13,10 +13,10 @@ accounts:
     :secret: test2_secret
 
 tag_policy:
-  - :required:
-    - Application
-    - Owner
-    - Environment
-  - :recommended:
-    - Product
-    - Name
+   :required:
+   - Application
+   - Owner
+   - Environment
+   :recommended:
+   - Product
+   - Name

+ 2 - 1
lib/neoinfra/audit.rb

@@ -26,7 +26,8 @@ module NeoInfra
           new_conn = Fog::Compute.new(region_conf.merge(base_conf))
           new_conn.servers.all.each do |ec2|
             %i[required recommended].each do |a|
-              next unless @cfg.tag_policy.key? a
+              next unless @cfg.tag_policy.has_key? a
+              puts 'Foo'
               next if (ec2.tags.keys.sort & @cfg.tag_policy[a].sort) == @cfg.tag_policy[a].sort
               results[ec2.id].merge!("#{a}_missing_tags" => @cfg.tag_policy[a].sort - ec2.tags.keys.sort,
                                      'tags' => ec2.tags.keys.sort,