cheftacular 2.7.2 → 2.8.0

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
2
  SHA1:
3
- metadata.gz: 87110df9f5a710c9cb37d8e5deb6c307c58e5382
4
- data.tar.gz: ec5cab59e6965577aa4cb5730ae101a7cbbf48bc
3
+ metadata.gz: 0eeae950bbcfe62a1c46bc55de2d7eb5ae3df178
4
+ data.tar.gz: 42f580f12bc1949089b59dfc44320db04e5f80f0
5
5
  SHA512:
6
- metadata.gz: 5ed413df125694ecaa9daaf930e9edc3d9302f9369a7efeb13cd342f857eddf40f9d177d62b73fd702e550fc34f785017cefb0d721c09899218390b42b5182fa
7
- data.tar.gz: a946af42bd4eb240cb3f6296aa675102e6cd06c2ea720a50ab93c5063a1245bf1caec35b58f97344561471e7d454be320ad3b38f1b839d94cc284362c87aebb4
6
+ metadata.gz: d459b3ef3d98c11a77dae22b15f5d3b882608d54735bd4675caf3a10da5146856a029a2ee3517fafcf11cdfebb3503d267b1ebe7f8100ea68438c4f37e198f9d
7
+ data.tar.gz: 86a4c1f2d457225a047dccfc4cca6b6648852df73fa0cd673efa14dbc1939889b3eab05bb70bb9c84420f0b3b9ea3597defd1d4069c42a1e05bafbaae05f1c6c
@@ -3,13 +3,18 @@ class Cheftacular
3
3
  def check
4
4
  @config['documentation']['action'] << [
5
5
  "`cft check` Checks the commits for all servers for a repository (for an environment) and returns them in a simple chart. " +
6
- "Also shows when these commits were deployed to the server."
6
+ "Also shows when these commits were deployed to the server.",
7
+
8
+ [
9
+ " 1. If the node has special repository based keys from TheCheftacularCookbook, this command will also display information " +
10
+ "about the branch and organization currently deployed to the node(s)."
11
+ ]
7
12
  ]
8
13
  end
9
14
  end
10
15
 
11
16
  class Action
12
- def check commit_hash={}, have_revisions=false
17
+ def check commit_hash={}, have_revisions=false, have_changed_orgs=false
13
18
  @config['filesystem'].cleanup_file_caches('current-nodes')
14
19
 
15
20
  nodes = @config['getter'].get_true_node_objects
@@ -22,19 +27,26 @@ class Cheftacular
22
27
 
23
28
  puts("Beginning commit check run for #{ n.name } (#{ n.public_ipaddress }) on role #{ options['role'] }") unless options['quiet']
24
29
 
25
- commit_hash[n.name] = start_commit_check( n.name, n.public_ipaddress, options, locs, cheftacular)
26
- commit_hash[n.name]['branch'] = n.normal_attributes[options['repository']]['repo_branch'] if n.normal_attributes.has_key?(options['repository'])
27
- have_revisions = true if commit_hash[n.name].has_key?('branch')
30
+ commit_hash[n.name] = start_commit_check( n.name, n.public_ipaddress, options, locs, cheftacular)
31
+
32
+ if n.normal_attributes.has_key?(options['repository'])
33
+ commit_hash[n.name]['branch'] = n.normal_attributes[options['repository']]['repo_branch'] if n.normal_attributes[options['repository']].has_key?('repo_branch')
34
+ commit_hash[n.name]['organization'] = n.normal_attributes[options['repository']]['repo_group'] if n.normal_attributes[options['repository']].has_key?('repo_group')
35
+ end
36
+
37
+ have_revisions = true if commit_hash[n.name].has_key?('branch')
38
+ have_changed_orgs = true if commit_hash[n.name].has_key?('organization')
28
39
  end
29
40
 
30
- puts "\n#{ 'name'.ljust(21) }#{ 'deployed_on'.ljust(22) } #{ 'commit'.ljust(40) } #{'revision'.ljust(30) if have_revisions }"
41
+ puts "\n#{ 'name'.ljust(21) }#{ 'deployed_on'.ljust(22) } #{ 'commit'.ljust(40) } #{'revision'.ljust(29) if have_revisions } #{'organization'.ljust(30) if have_changed_orgs }"
31
42
  nodes.each do |n|
32
43
  unless commit_hash[n.name]['name'].blank?
33
44
  out = []
34
45
  out << n.name.ljust(20, '_')
35
46
  out << commit_hash[n.name]['time'].ljust(21)
36
47
  out << commit_hash[n.name]['name'].ljust(39)
37
- out << commit_hash[n.name]['branch'].ljust(30) if commit_hash[n.name].has_key?('branch')
48
+ out << commit_hash[n.name]['branch'].ljust(29) if commit_hash[n.name].has_key?('branch')
49
+ out << commit_hash[n.name]['organization'].ljust(30) if commit_hash[n.name].has_key?('organization')
38
50
 
39
51
  puts out.join(' ')
40
52
  end
@@ -6,13 +6,17 @@ class Cheftacular
6
6
  "Logs of the run itself will be sent to the local log directory in the application (or chef-repo) where the run was conducted.",
7
7
 
8
8
  [
9
- " 1. This command also restarts services on the server and updates the code. Changes behavior slightly with the `-z|-Z` args " +
10
- "but only if your cookbooks support switching revisions based on tags / branch names.",
9
+ " 1. The `-Z REVISION` flag can be used with TheCheftacularCookbook to set a revision your app will run. ",
11
10
 
12
- " 2. This command will also run migrations on both an role's normal servers and its split servers if certain " +
11
+ " 2. The `-O ORGANIZATION` flag can be used with TheCheftacularCookbook to set an *organization* your app can try " +
12
+ "deploying from, your git user needs access to these forks / organization(s).",
13
+
14
+ " 3. The `-z|--unset-github-deploy-args` option will clear your current `-Z` and `-O` flags.",
15
+
16
+ " 4. This command will also run migrations on both an role's normal servers and its split servers if certain " +
13
17
  "conditions are met (such as the role having a database, etc).",
14
18
 
15
- " 3. The `-v|--verbose` option will cause failed deploys to output to the terminal window and to their normal log file. Useful for debugging."
19
+ " 5. The `-v|--verbose` option will cause failed deploys to output to the terminal window and to their normal log file. Useful for debugging."
16
20
  ]
17
21
  ]
18
22
  end
@@ -134,15 +134,14 @@ class Cheftacular
134
134
  end
135
135
 
136
136
  def should_route_wildcard_requests? node_name, env, descriptor, should_route_requests=false
137
- repository_hash = descriptor.blank? ? {} : @config['parser'].parse_repository_hash_from_string(descriptor)
137
+ repository_hash = descriptor.blank? ? {} : @config['parser'].parse_repository_hash_from_string(descriptor)
138
+ repository_hash ||= {}
138
139
 
139
140
  if repository_hash.empty?
140
141
  puts "Blank repository hash parsed for #{ node_name } in #{ env } with descriptor #{ descriptor }. Setting should route wildcard requests for server to false."
141
142
  end
142
143
 
143
- #puts "repositories:#{ repository_hash['role'] }:#{ repository_hash['repo_name'] }:route_wildcard_requests_for_tld"
144
-
145
- if @config['helper'].does_cheftacular_config_have?(["repositories:#{ repository_hash['role'] }:route_wildcard_requests_for_tld"])
144
+ if repository_hash.has_key?('role') && @config['helper'].does_cheftacular_config_have?(["repositories:#{ repository_hash['role'] }:route_wildcard_requests_for_tld"])
146
145
  should_route_requests = @config['cheftacular']['repositories'][repository_hash['role']]['route_wildcard_requests_for_tld']
147
146
  end
148
147
 
@@ -120,11 +120,11 @@ class Cheftacular
120
120
  ret_hash
121
121
  end
122
122
 
123
- def get_db_primary_node
123
+ def get_db_primary_node_and_nodes
124
124
  nodes = get_true_node_objects true
125
125
  target_db_role = get_current_repo_config['db_primary_host_role']
126
126
 
127
- @config['parser'].exclude_nodes( nodes, [{ unless: "role[#{ target_db_role }]" }, { if: { not_env: @options['env'] } }], true)
127
+ [@config['parser'].exclude_nodes( nodes, [{ unless: "role[#{ target_db_role }]" }, { if: { not_env: @options['env'] } }], true), nodes]
128
128
  end
129
129
 
130
130
  def get_split_branch_hash ret={}
@@ -135,13 +135,23 @@ class Cheftacular
135
135
  ret
136
136
  end
137
137
 
138
- def get_address_hash node_name, ret={}
138
+ def get_address_hash node_name, load_out_of_env_addresses=false, ret={}
139
+ break_on_found = false
140
+
139
141
  @config['chef_environments'].each do |env|
140
- next unless @config.has_key?(env) #in case the env hashes are not loaded
142
+ next if !load_out_of_env_addresses && !@config.has_key?(env) #in case the env hashes are not loaded
143
+ @config['initializer'].initialize_data_bags_for_environment(env, false, ['addresses']) if @options['env'] != env
141
144
 
142
145
  @config[env]['addresses_bag_hash']['addresses'].each do |serv_hash|
143
- ret[serv_hash['name']] = { "dn" => serv_hash['dn'], "priv" => serv_hash['address'], "pub" => serv_hash['public'] } if serv_hash['name'] == node_name
146
+ if serv_hash['name'] == node_name
147
+ ret[serv_hash['name']] = { "dn" => serv_hash['dn'], "priv" => serv_hash['address'], "pub" => serv_hash['public'] }
148
+ break_on_found = true
149
+
150
+ break
151
+ end
144
152
  end
153
+
154
+ break if break_on_found
145
155
  end
146
156
 
147
157
  ret
@@ -151,14 +151,18 @@ class Cheftacular
151
151
  @options['negative_role'] = name
152
152
  end
153
153
 
154
- opts.on('-z', '--unset-revision', 'Tells the chef-server that we want to return to using the default revision for a repository') do
155
- @options['unset_revision'] = true
154
+ opts.on('-z', '--unset-github-deploy-args', 'Tells the chef-server that we want to return to using the default revision and organization for a repository') do
155
+ @options['unset_github_deploy_args'] = true
156
156
  end
157
157
 
158
158
  opts.on('-Z REVISION', '--revision REVISION', "Tells the chef-server what branch / revision it should deploy for a repository") do |revision|
159
159
  @options['target_revision'] = revision
160
160
  end
161
161
 
162
+ opts.on('-O ORGANIZATION', '--deploy-org ORGANIZATION', "Tells the chef-server to use a certain organization on deploys (git user must have access)") do |org|
163
+ @options['deploy_organization'] = org
164
+ end
165
+
162
166
  # client-list
163
167
  opts.on('-W', '--with-priv', "On client-list this will show each server's private addresses") do
164
168
  @options['with_private'] = true
@@ -416,6 +420,7 @@ class Cheftacular
416
420
 
417
421
  #TODO Reevaluate for non-rvm setups
418
422
  @config['bundle_command'] = "/home/#{ @config['cheftacular']['deploy_user'] }/.rvm/gems/#{ @config['ruby_string'].chomp }@global/bin/bundle"
423
+ @config['ruby_command'] = "/home/#{ @config['cheftacular']['deploy_user'] }/.rvm/rubies/#{ @config['ruby_string'].chomp }/bin/ruby"
419
424
  end
420
425
 
421
426
  def initialize_passwords env, refresh_bag=false
@@ -21,7 +21,7 @@ class Cheftacular
21
21
 
22
22
  parse_address(@options['address']) if @options['address']
23
23
 
24
- parse_and_set_revision if @options['target_revision'] || @options['unset_revision']
24
+ parse_and_set_deploy_args if @options['target_revision'] || @options['deploy_organization'] || @options['unset_github_deploy_args']
25
25
  end
26
26
 
27
27
  #try and get the most accurate name of the repo
@@ -99,15 +99,18 @@ class Cheftacular
99
99
  end
100
100
  end
101
101
 
102
- def parse_and_set_revision
102
+ def parse_and_set_deploy_args
103
103
  raise "Cannot set or unset target_revision without a role" unless @options['role']
104
104
 
105
- if @options['target_revision']
106
- @config[@options['env']]['config_bag_hash'][@options['sub_env']]['app_revisions'][@config['getter'].get_repository_from_role_name(@options['role'])] = @options['target_revision']
105
+ repo_state_hash = @config[@options['env']]['config_bag_hash'][@options['sub_env']]['app_revisions'][@config['getter'].get_repository_from_role_name(@options['role'])]
106
+ repo_state_hash ||= {}
107
107
 
108
- elsif @options['unset_revision']
109
- @config[@options['env']]['config_bag_hash'][@options['sub_env']]['app_revisions'][@config['getter'].get_repository_from_role_name(@options['role'])] = "<use_default>"
108
+ repo_state_hash['revision'] = @options['target_revision'] if @options['target_revision']
109
+ repo_state_hash['deploy_organization'] = @options['deploy_organization'] if @options['deploy_organization']
110
110
 
111
+ if @options['unset_github_deploy_args']
112
+ repo_state_hash['revision'] = nil
113
+ repo_state_hash['deploy_organization'] = nil
111
114
  end
112
115
 
113
116
  @config['ChefDataBag'].save_config_bag
@@ -3,7 +3,7 @@ class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def backups
5
5
  @config['documentation']['stateless_action'] << [
6
- "`cft backups [activate|deactivate|load|run]` this command " +
6
+ "`cft backups [activate|deactivate|load|restore]` this command " +
7
7
  "sets the fetch_backups and restore_backups flags in your config data bag for an environment. " +
8
8
  "These can be used to give application developers a way to trigger / untrigger restores in an environment",
9
9
 
@@ -15,7 +15,7 @@ class Cheftacular
15
15
  " 3. `load` will fetch the latest backup from the production primary **if it doesn't already exist on " +
16
16
  "the server** and run the _backup loading command_ to load this backup into the env.",
17
17
 
18
- " 4. `run` will simply just run the _backup loading command_ to load the latest backup onto the server."
18
+ " 4. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server."
19
19
  ]
20
20
  ]
21
21
 
@@ -27,7 +27,7 @@ class Cheftacular
27
27
  def backups command=''
28
28
  command = ARGV[1] if command.blank?
29
29
 
30
- raise "Unsupported command (#{ command }) for cft backups" unless command =~ /activate|deactivate|load|run/
30
+ raise "Unsupported command (#{ command }) for cft backups" unless command =~ /activate|deactivate|load|restore/
31
31
 
32
32
  self.send("backups_#{ command }")
33
33
  end
@@ -59,7 +59,7 @@ class Cheftacular
59
59
  @options['role'] = old_role
60
60
  @options['env'] = old_env
61
61
 
62
- target_db_primary = @config['getter'].get_db_primary_node
62
+ target_db_primary, nodes = @config['getter'].get_db_primary_node_and_nodes
63
63
 
64
64
  args_config = [
65
65
  { unless: "role[#{ @config['cheftacular']['backup_config']['global_backup_role_name'] }]" },
@@ -67,14 +67,14 @@ class Cheftacular
67
67
  ]
68
68
 
69
69
  backup_master = @config['parser'].exclude_nodes( nodes, args_config, true)
70
- backup_master_local_ip = @config['getter'].get_address_hash(backup_master.first.name)['priv']
70
+ backup_master_local_ip = @config['getter'].get_address_hash(backup_master.first.name, true)[backup_master.first.name]['priv']
71
71
 
72
72
  options, locs, ridley, logs_bag_hash, pass_bag_hash, bundle_command, cheftacular, passwords = @config['helper'].set_local_instance_vars
73
73
 
74
74
  on ( backup_master.map { |n| @config['cheftacular']['deploy_user'] + "@" + n.public_ipaddress } ) do |host|
75
75
  n = get_node_from_address(nodes, host.hostname)
76
76
 
77
- puts("Beginning latest db_fetch_and_check for #{ n.name } (#{ n.public_ipaddress }) for env #{ options['env'] }") unless options['quiet']
77
+ puts("Beginning latest db_fetch_and_check for #{ n.name } (#{ n.public_ipaddress }) for env #{ backup_env }") unless options['quiet']
78
78
 
79
79
  status_hash['latest_backup'] = start_db_check_and_fetch( n.name, n.public_ipaddress, options, locs, cheftacular, passwords)
80
80
  end
@@ -89,22 +89,24 @@ class Cheftacular
89
89
  start_db_backup_fetch( n.name, n.public_ipaddress, options, locs, cheftacular, passwords, backup_master_local_ip, status_hash['latest_backup'])
90
90
  end
91
91
 
92
- backups_run(nodes)
92
+ backups_restore
93
93
  end
94
94
 
95
- def backups_run
96
- target_db_primary = @config['getter'].get_db_primary_node
97
- applications_as_string = @config['getter'].get_repo_names_for_repositories.keys.join(',')
98
- env_pg_pass = @config[@options['env']]['chef_passwords_bag_hash']['pg_pass']
95
+ def backups_restore
96
+ target_db_primary, nodes = @config['getter'].get_db_primary_node_and_nodes
97
+ applications_as_string = @config['getter'].get_repo_names_for_repositories.keys.join(',')
98
+ env_pg_pass = @config[@options['env']]['chef_passwords_bag_hash']['pg_pass']
99
99
 
100
100
  options, locs, ridley, logs_bag_hash, pass_bag_hash, bundle_command, cheftacular, passwords = @config['helper'].set_local_instance_vars
101
101
 
102
+ ruby_command = @config['ruby_command']
103
+
102
104
  on ( target_db_primary.map { |n| @config['cheftacular']['deploy_user'] + "@" + n.public_ipaddress } ) do |host|
103
105
  n = get_node_from_address(nodes, host.hostname)
104
106
 
105
107
  puts("Beginning db_backup_run for #{ n.name } (#{ n.public_ipaddress }) for env #{ options['env'] }") unless options['quiet']
106
108
 
107
- start_db_backup_run( n.name, n.public_ipaddress, options, locs, cheftacular, passwords, applications_as_string, env_pg_pass )
109
+ start_db_backup_restore( n.name, n.public_ipaddress, options, locs, cheftacular, passwords, applications_as_string, env_pg_pass, ruby_command )
108
110
  end
109
111
  end
110
112
 
@@ -154,46 +156,59 @@ module SSHKit
154
156
  end
155
157
 
156
158
  return_hash['file_check'] = true
157
- return_hash['file_path'] = [target_dir].flatten.last
159
+ return_hash['filename'] = [target_dir].flatten.last
158
160
  return_hash['file_dir'] = case cheftacular['backup_filesystem']
159
161
  when 'backup_gem' then target_dir.first
160
162
  when 'raw' then base_dir
161
163
  end
162
164
 
165
+ return_hash['backup_master_path'] = case cheftacular['backup_filesystem']
166
+ when 'backup_gem' then File.join(base_dir, return_hash['file_dir'], return_hash['filename'])
167
+ when 'raw' then File.join(base_dir, return_hash['filename'])
168
+ end
169
+
163
170
  return_hash
164
171
  end
165
172
 
166
173
  def start_db_backup_fetch name, ip_address, options, locs, cheftacular, passwords, backup_master_local_ip, backup_hash, out=[]
167
- if sudo_test( passwords[ip_address], backup_path ) #true if dir exists
168
- puts "#{ name } (#{ ip_address }) already has the backup at #{ backup_path }, skipping #{ __method__ }..."
174
+ full_backup_dir = File.join(cheftacular['backup_config']['db_primary_backup_path'], backup_hash['file_dir'])
175
+ full_backup_path = File.join(full_backup_dir, backup_hash['filename'])
176
+
177
+ if sudo_test( passwords[ip_address], full_backup_path ) #true if dir exists
178
+ puts "#{ name } (#{ ip_address }) already has the backup at #{ full_backup_path }, skipping #{ __method__ }..."
169
179
 
170
180
  return true
171
181
  end
172
182
 
173
- sudo_execute( passwords[ip_address], :mkdir, '-p', backup_hash['file_dir'] )
183
+ sudo_execute( passwords[ip_address], :mkdir, '-p', full_backup_dir )
174
184
 
175
- sudo_execute( passwords[ip_address], :chown, "#{ cheftacular['deploy_user'] }:#{ cheftacular['deploy_user'] }", backup_hash['file_dir'] )
185
+ sudo_execute( passwords[ip_address], :chown, "#{ cheftacular['deploy_user'] }:#{ cheftacular['deploy_user'] }", full_backup_dir )
176
186
 
177
- sudo_execute( passwords[ip_address], :chmod, cheftacular['backup_config']['backup_dir_mode'], backup_hash['file_dir'] )
187
+ sudo_execute( passwords[ip_address], :chmod, cheftacular['backup_config']['backup_dir_mode'], full_backup_dir )
178
188
 
179
- execute( :scp, "#{ cheftacular['deploy_user'] }@#{ backup_master_local_ip }:#{ backup_hash['file_path'] }", backup_hash['file_dir'] )
189
+ execute( :scp, '-oStrictHostKeyChecking=no', "#{ cheftacular['deploy_user'] }@#{ backup_master_local_ip }:#{ backup_hash['backup_master_path'] }", full_backup_path )
180
190
 
181
- puts "Finished transferring #{ backup_hash['file_path'] } to #{ name }(#{ ip_address })..."
191
+ puts "Finished transferring #{ full_backup_path } to #{ name }(#{ ip_address })..."
182
192
  end
183
193
 
184
- def start_db_backup_run name, ip_address, options, locs, cheftacular, passwords, applications_as_string, env_pg_pass
194
+ def start_db_backup_restore name, ip_address, options, locs, cheftacular, passwords, applications_as_string, env_pg_pass, ruby_command, out=''
195
+ log_loc, timestamp = set_log_loc_and_timestamp(locs)
196
+
185
197
  puts "Beginning backup run on #{ name } (#{ ip_address }), this command may take a while to complete..."
198
+
186
199
  case cheftacular['backup_filesystem']
187
200
  when 'backup_gem'
188
- #'ruby /root/backup_management.rb /mnt/postgresbackups/backups ENVIRONMENT APPLICATIONS PG_PASS > /root/restore.log 2>&1'
189
201
  command = cheftacular['backup_config']['backup_load_command']
190
202
  command = command.gsub('ENVIRONMENT', options['env']).gsub('APPLICATIONS', applications_as_string).gsub('PG_PASS', env_pg_pass)
203
+ command = command.gsub('RUBY_COMMAND', ruby_command )
191
204
 
192
- sudo_execute( passwords[ip_address], command )
205
+ out << sudo_capture( passwords[ip_address], command )
193
206
  when 'raw'
194
207
  end
195
208
 
196
- puts "Finished executing backup command on #{ name } (#{ ip_address })"
209
+ ::File.open("#{ log_loc }/#{ name }-backup-restore-#{ timestamp }.txt", "w") { |f| f.write(out.scrub_pretty_text) } unless options['no_logs']
210
+
211
+ puts "Finished executing backup command on #{ name } (#{ ip_address }). Wrote logs to #{ log_loc }/#{ name }-backup-restore-#{ timestamp }.txt"
197
212
  end
198
213
 
199
214
  def backup_gem_dir_sort password, cheftacular, base_dir
@@ -220,7 +235,7 @@ module SSHKit
220
235
 
221
236
  target_file = sudo_capture( password, :ls, File.join(base_dir, target_dir) ).split(' ').last
222
237
 
223
- [ File.join(base_dir, target_dir), File.join( target_dir, target_file )]
238
+ [ target_dir, target_file ]
224
239
  end
225
240
  end
226
241
  end
@@ -50,6 +50,7 @@ class Cheftacular
50
50
  when 'boot'
51
51
  initial_servers.each_pair do |name, config_hash|
52
52
  next if nodes.map { |n| n.name }.include?(name)
53
+ config_hash ||= {}
53
54
 
54
55
  @options['node_name'] = name
55
56
  @options['flavor_name'] = config_hash.has_key?('flavor') ? config_hash['flavor'] : @config['cheftacular']['default_flavor_name']
@@ -168,6 +168,19 @@ class Cheftacular
168
168
  save_on_finish = true
169
169
  end
170
170
 
171
+ @config['getter'].get_repo_names_for_repositories.each_key do |repo_name|
172
+ #upgrades pre 2.7.2 to 2.8.0+ for config bag formats TODO DELETE ME (remove after 3.0.0)
173
+ if hash[env]['app_revisions'].has_key?(repo_name) && hash[env]['app_revisions'][repo_name].class.to_s == 'String'
174
+ hash[env]['app_revisions'][repo_name] = { "revision" => hash[env]['app_revisions'][repo_name] }
175
+ end
176
+
177
+ unless hash[env]['app_revisions'].has_key?(repo_name)
178
+ hash[env]['app_revisions'][repo_name] = {}
179
+
180
+ save_on_finish = true
181
+ end
182
+ end
183
+
171
184
  unless hash[env].has_key?('cloudflare_activated_domains')
172
185
  hash[env]['cloudflare_activated_domains'] = []
173
186
 
@@ -62,7 +62,7 @@ class Cheftacular
62
62
  @config['ChefDataBag'].save_addresses_bag
63
63
  end
64
64
  end
65
-
65
+
66
66
  puts("Done. Please verify that the output of the next line(s) match your expectations (running client-list)") if @options['verbose']
67
67
 
68
68
  puts(`client-list`) if @options['verbose']
@@ -2,6 +2,10 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def role_toggle
5
+ #set these config vars as they may not be loaded on an initialization run in a application repo
6
+ @config['cheftacular']['role_toggling'] ||= {}
7
+ @config['cheftacular']['role_toggling']['deactivated_role_suffix'] ||= '_deactivate'
8
+
5
9
  @config['documentation']['stateless_action'] << [
6
10
  "`cft role_toggle NODE_NAME ROLE_NAME activate|deactivate` This command will allow you to **toggle** roles on nodes without using `cft upload_nodes`",
7
11
 
@@ -54,8 +54,6 @@ class Cheftacular
54
54
 
55
55
  @config[@options['env']]['config_bag_hash'][@options['sub_env']]['tld'] = target_tld
56
56
 
57
- puts "BAG TLD::#{ @config[@options['env']]['config_bag_hash'][@options['sub_env']]['tld'] }"
58
-
59
57
  @config['ChefDataBag'].save_config_bag
60
58
  @config['ChefDataBag'].save_addresses_bag
61
59
  end
@@ -1,5 +1,5 @@
1
1
  class Cheftacular
2
2
  #major_version.minor_version.bugfixes
3
- VERSION = "2.7.2"
3
+ VERSION = "2.8.0"
4
4
  RUBY_VERSION = "2.2.2"
5
5
  end
@@ -7,7 +7,7 @@ module SSHKit
7
7
 
8
8
  puts "Running #{ command } for #{ name } (#{ ip_address }) (Run with with --debug to generate a log as well)"
9
9
 
10
- target_loc = "/var/www/vhosts/#{ options['repository'] }/current"
10
+ target_loc = "#{ cheftacular['base_file_path'] }/#{ options['repository'] }/current"
11
11
 
12
12
  if test( target_loc )
13
13
  puts "#{ name } (#{ ip_address }) cannot run #{ command } as there is no directory at #{ target_loc }!"
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.7.2
4
+ version: 2.8.0
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-09-24 00:00:00.000000000 Z
11
+ date: 2015-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie