cheftacular 2.2.0 → 2.2.1

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: 432e618db73dd2f0c3c13dde66a0ba2d48139404
4
- data.tar.gz: 24eba2f067f13d14f95075101b1eaabdbd2b767d
3
+ metadata.gz: c20403e9a06c24107c229161f34ed5ae10eb2360
4
+ data.tar.gz: e9edf5b27994a98c4dbbc5aa07eab3907d5303ab
5
5
  SHA512:
6
- metadata.gz: 879cda27b14935f3e68ef5570d24c1e60bcfd2e33b3a25fd0126fb25b0f1669b4b5f8f9d55716f7b5e9de50046d7099fbaebc710c6074aca7e0e710630efa874
7
- data.tar.gz: 745b5247a4393cda8a083a8215230d9e6d1a41c0653e91e8d537c13fd2f7ab7be8b387ac1d11cde2c71cf9e73f5bb52d32a66ade4c3f8b7519714bdb6449a6bb
6
+ metadata.gz: e1a81ce225e84ab00701c15cee3d7cc5c519134795b4b382f55e4e9a4c8a59183d934cecc85e8afdedd2e49dafc80e1913da1e480cf4631f2e67836724001877
7
+ data.tar.gz: 294dda1dc967aca367b832dcee99e6a2b5dac916b4ae877af379727ad9f71c3f5f7ad649701c60a6a075eb7b5d62519895f7f3ac2de9c61f774660e9d54cdc2e
@@ -28,6 +28,8 @@ class Cheftacular
28
28
  item = @config[env]['logs_bag'].reload
29
29
 
30
30
  #TODO use zlib gem to store and display logs https://stackoverflow.com/questions/17882463/compressing-large-string-in-ruby
31
+ #Zlib::Deflate.deflate(data_to_compress)
32
+ #Zlib::Inflate.inflate(data_compressed)
31
33
  item.attributes = item.attributes.deep_merge(@config[env]['logs_bag_hash'].dup)
32
34
 
33
35
  begin
@@ -21,6 +21,7 @@ require 'net/http'
21
21
  require 'timeout'
22
22
  require 'slack-notifier'
23
23
  require 'cloudflare'
24
+ require 'zlib'
24
25
 
25
26
  Dir["#{File.dirname(__FILE__)}/../**/*.rb"].each { |f| require f }
26
27
 
@@ -142,7 +142,7 @@ class Cheftacular
142
142
  end
143
143
 
144
144
  def compile_address_hash_for_server_from_options *args
145
- target_serv_index = nil
145
+ target_serv_index = args.include?('set_hash_to_nil') ? nil : @config[@options['env']]['addresses_bag_hash']['addresses'].count
146
146
  tld = @config[@options['env']]['config_bag_hash'][@options['sub_env']]['tld']
147
147
 
148
148
  args.each do |arg|
@@ -155,6 +155,8 @@ class Cheftacular
155
155
 
156
156
  full_domain ||= "#{ @options['node_name'] }.#{ tld }"
157
157
 
158
+ @config[@options['env']]['addresses_bag_hash'] = @config[@options['env']]['addresses_bag'].reload.to_hash
159
+
158
160
  @config[@options['env']]['addresses_bag_hash']['addresses'].each do |serv_hash|
159
161
  target_serv_index = @config[@options['env']]['addresses_bag_hash']['addresses'].index(serv_hash) if serv_hash['name'] == @options['node_name']
160
162
  end
@@ -10,15 +10,21 @@ class Cheftacular
10
10
  Cheftacular.to_s.underscore.dasherize
11
11
  end
12
12
 
13
- def is_command? command
13
+ def is_command? command=''
14
+ command ||= ''
15
+
14
16
  @config['action'].public_methods(false).include?(command.to_sym)
15
17
  end
16
18
 
17
- def is_stateless_command? command
19
+ def is_stateless_command? command=''
20
+ command ||= ''
21
+
18
22
  @config['stateless_action'].public_methods(false).include?(command.to_sym)
19
23
  end
20
24
 
21
- def is_not_command_or_stateless_command? command
25
+ def is_not_command_or_stateless_command? command=''
26
+ command ||= ''
27
+
22
28
  !@config['action'].public_methods(false).include?(command.to_sym) && !@config['stateless_action'].public_methods(false).include?(command.to_sym)
23
29
  end
24
30
 
@@ -42,7 +42,7 @@ class Cheftacular
42
42
 
43
43
  parse_repository(@options['repository'])
44
44
 
45
- @options['command'] = ARGV[0] unless @config['helper'].is_not_command_or_stateless_command?(ARGV[0])
45
+ @options['command'] = ARGV[0] unless @config['helper'].is_not_command_or_stateless_command?(ARGV[0])
46
46
  end
47
47
 
48
48
  return if !@options['codebase'].nil? && !@options['role'].nil? && !@options['command'].nil?
@@ -70,8 +70,6 @@ class Cheftacular
70
70
  @config['DNS'].create_dns_record_for_domain_from_address_hash(@options['with_dn'], address_hash, "specific_domain_mode") if @options['with_dn']
71
71
 
72
72
  @config['DNS'].create_dns_record_for_domain_from_address_hash(tld, address_hash)
73
-
74
- @config[@options['env']]['addresses_bag_hash'] = @config[@options['env']]['addresses_bag'].reload.to_hash
75
73
 
76
74
  @config['ChefDataBag'].save_addresses_bag
77
75
 
@@ -82,6 +82,16 @@ class Cheftacular
82
82
  allowed_changes_hash = bag_hash
83
83
  end
84
84
 
85
+ #force add any roles that are not in the bag in the event force yes is turned on
86
+ (node_roles_hash.keys - bag_hash.keys).each do |role_not_in_node_roles_bag|
87
+
88
+ new_role = node_roles_hash[role_not_in_node_roles_bag]
89
+
90
+ allowed_changes_hash[role_not_in_node_roles_bag] = bag_hash[role_not_in_node_roles_bag]
91
+
92
+ @config[new_role['chef_environment']]['node_roles_bag_hash']['node_roles'][new_role['name']] = new_role
93
+ end if @options['force_yes'] && @config['helper'].running_in_mode?('devops')
94
+
85
95
  nodes.each do |node|
86
96
  # if there is a node_roles file that completely matches the name of the file, use it
87
97
  changes_for_current_node = false
@@ -1,5 +1,5 @@
1
1
  class Cheftacular
2
2
  #major_version.minor_version.bugfixes
3
- VERSION = "2.2.0"
3
+ VERSION = "2.2.1"
4
4
  RUBY_VERSION = "2.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheftacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Alridge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-06 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie