cheftacular 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cheftacular/actions/console.rb +1 -1
- data/lib/cheftacular/actions/deploy.rb +24 -1
- data/lib/cheftacular/actions/log.rb +1 -1
- data/lib/cheftacular/actions/tail.rb +1 -1
- data/lib/cheftacular/cheftacular.rb +1 -1
- data/lib/cheftacular/dns.rb +1 -1
- data/lib/cheftacular/getter.rb +1 -1
- data/lib/cheftacular/helper.rb +39 -1
- data/lib/cheftacular/initializer.rb +40 -18
- data/lib/cheftacular/parser.rb +2 -2
- data/lib/cheftacular/stateless_actions/arguments.rb +1 -1
- data/lib/cheftacular/stateless_actions/bootstrappers/ubuntu_bootstrap.rb +1 -1
- data/lib/cheftacular/stateless_actions/compile_audit_log.rb +4 -4
- data/lib/cheftacular/stateless_actions/environment.rb +3 -3
- data/lib/cheftacular/stateless_actions/initialize_data_bag_contents.rb +3 -3
- data/lib/cheftacular/stateless_actions/test_env.rb +6 -2
- data/lib/cheftacular/stateless_actions/update_split_branches.rb +5 -3
- data/lib/cheftacular/version.rb +1 -1
- data/lib/cloud_interactor/cloud_interactor.rb +3 -0
- data/lib/sshkit/actions/start_task.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46547d3aa90d80b995df07810a4675b88f3d4822
|
4
|
+
data.tar.gz: 1e8ea61b705880d022271335953a9c2364b200a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5a4f09cba60332a5d60ed2de80747b900601006132a5dbcb6e10ed9fa6f741c2b82482bcc5ac4c6689a30cbfb708b24d253f66bae9c9fdf82f8c0895170a293
|
7
|
+
data.tar.gz: 5e0101b89e3f56ad978669ca89c5f0a460e0aa19dfde40d1ee73ec0f2dfb9aed5565854b497a1b2eab5b56e8bc239e5384b5a2aa5f1a0f258ba53c30ce475bbf
|
@@ -41,7 +41,7 @@ class Cheftacular
|
|
41
41
|
|
42
42
|
def start_console_ruby_on_rails ip_address, run_list
|
43
43
|
app_loc = "#{ @config['cheftacular']['base_file_path'] }/#{ @options['repository'] }/current"
|
44
|
-
true_env = @config['dummy_sshkit'].get_true_environment run_list, @config['cheftacular']['run_list_environments'], @options['env']
|
44
|
+
true_env = @config['dummy_sshkit'].get_true_environment run_list, @config['cheftacular']['run_list_environments'][@options['env']], @options['env']
|
45
45
|
|
46
46
|
#the >/dev/tty after the ssh block redirects the full output to stdout, not /dev/null where it normally goes
|
47
47
|
`ssh -oStrictHostKeyChecking=no -tt deploy@#{ ip_address } "cd #{ app_loc } && RAILS_ENV=#{ true_env } #{ @config['bundle_command'] } exec rails c" > /dev/tty`
|
@@ -7,7 +7,10 @@ class Cheftacular
|
|
7
7
|
|
8
8
|
[
|
9
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."
|
10
|
+
"but only if your cookbooks support switching revisions based on tags / branch names.",
|
11
|
+
|
12
|
+
" 2. This command will also run migrations on both an role's normal servers and its split servers if certain " +
|
13
|
+
"conditions are met (such as the role having a database, etc)."
|
11
14
|
]
|
12
15
|
]
|
13
16
|
end
|
@@ -36,6 +39,26 @@ class Cheftacular
|
|
36
39
|
#@config['ChefDataBag'].save_logs_bag unless @options['debug'] #We don't really need to store entire chef runs in the logs bag
|
37
40
|
|
38
41
|
migrate(nodes) if @config['getter'].get_current_repo_config['database'] != 'none' && !@options['run_migration_already']
|
42
|
+
|
43
|
+
split_nodes_hash = {}
|
44
|
+
|
45
|
+
@config['cheftacular']['run_list_environments'][@options['env']].each_key do |role_name|
|
46
|
+
split_nodes_hash[role_name] = @config['parser'].exclude_nodes( nodes, [{ unless: "role[#{ role_name }]" }])
|
47
|
+
end
|
48
|
+
|
49
|
+
split_nodes_hash.each_pair do |role, split_nodes|
|
50
|
+
next if split_nodes.empty?
|
51
|
+
|
52
|
+
unless @options["run_#{ role }_migrations_already"]
|
53
|
+
@options["run_#{ role }_migrations_already"] = true
|
54
|
+
|
55
|
+
if @config['getter'].get_current_repo_config['database'] != 'none'
|
56
|
+
puts("Running migration on split environment #{ role }...") if !@options['quiet']
|
57
|
+
|
58
|
+
migrate(split_nodes)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
39
62
|
end
|
40
63
|
end
|
41
64
|
end
|
@@ -76,7 +76,7 @@ module SSHKit
|
|
76
76
|
|
77
77
|
def start_log_fetch_ruby_on_rails name, ip_address, run_list, options, locs, cheftacular, passwords, out=""
|
78
78
|
log_loc, timestamp = set_log_loc_and_timestamp(locs)
|
79
|
-
true_env = get_true_environment run_list, cheftacular['run_list_environments'], options['env']
|
79
|
+
true_env = get_true_environment run_list, cheftacular['run_list_environments'][options['env']], options['env']
|
80
80
|
app_log_loc = "#{ cheftacular['base_file_path'] }/#{ options['repository'] }/current/log"
|
81
81
|
log_cmnd, log_lines = get_log_command_and_lines(options)
|
82
82
|
|
@@ -43,7 +43,7 @@ class Cheftacular
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def start_tail_ruby_on_rails ip_address, run_list
|
46
|
-
true_env = @config['dummy_sshkit'].get_true_environment run_list, @config['cheftacular']['run_list_environments'], @options['env']
|
46
|
+
true_env = @config['dummy_sshkit'].get_true_environment run_list, @config['cheftacular']['run_list_environments'][@options['env']], @options['env']
|
47
47
|
|
48
48
|
#special servers should be listed first as most of them will have web role
|
49
49
|
log_loc = "#{ @config['cheftacular']['base_file_path'] }/#{ @options['repository'] }/current/log/#{ true_env }.log"
|
@@ -46,7 +46,7 @@ class Cheftacular
|
|
46
46
|
|
47
47
|
puts("Preparing to run command \"#{ @options['command'] }\"...") if @options['verbose']
|
48
48
|
|
49
|
-
@config['auditor'].audit_run if @config['cheftacular']['auditing']
|
49
|
+
@config['auditor'].audit_run if @config['cheftacular']['auditing']
|
50
50
|
|
51
51
|
@config['action'].send(@options['command']) if @config['helper'].is_command?(@options['command'])
|
52
52
|
|
data/lib/cheftacular/dns.rb
CHANGED
@@ -143,7 +143,7 @@ class Cheftacular
|
|
143
143
|
#puts "repositories:#{ repository_hash['role'] }:#{ repository_hash['repo_name'] }:route_wildcard_requests_for_tld"
|
144
144
|
|
145
145
|
if @config['helper'].does_cheftacular_config_have?(["repositories:#{ repository_hash['role'] }:route_wildcard_requests_for_tld"])
|
146
|
-
should_route_requests = @config['cheftacular']['repositories'][repository_hash['role']]['route_wildcard_requests_for_tld']
|
146
|
+
should_route_requests = @config['cheftacular']['repositories'][repository_hash['role']]['route_wildcard_requests_for_tld']
|
147
147
|
end
|
148
148
|
|
149
149
|
should_route_requests
|
data/lib/cheftacular/getter.rb
CHANGED
@@ -122,7 +122,7 @@ class Cheftacular
|
|
122
122
|
|
123
123
|
def get_split_branch_hash ret={}
|
124
124
|
@config['cheftacular']['repositories'].each_pair do |name, repo_hash|
|
125
|
-
ret[repo_hash['name']] = repo_hash if repo_hash.has_key?('has_split_branches') && repo_hash['has_split_branches']
|
125
|
+
ret[repo_hash['name']] = repo_hash if repo_hash.has_key?('has_split_branches') && repo_hash['has_split_branches']
|
126
126
|
end
|
127
127
|
|
128
128
|
ret
|
data/lib/cheftacular/helper.rb
CHANGED
@@ -251,7 +251,6 @@ class Cheftacular
|
|
251
251
|
FileUtils.rm("#{ base_dir }/#{ entry }") if File.file?("#{ base_dir }/#{ entry }") && entry.include?(Time.now.strftime("%Y%m%d"))
|
252
252
|
end
|
253
253
|
|
254
|
-
|
255
254
|
if File.exists?("#{ base_dir }/#{ entry }") && File.directory?("#{ base_dir }/#{ entry }")
|
256
255
|
FileUtils.rm_rf("#{ base_dir }/#{ entry }") if !check_current_day_entry && !entry.include?(Time.now.strftime("%Y%m%d"))
|
257
256
|
|
@@ -314,6 +313,45 @@ class Cheftacular
|
|
314
313
|
end
|
315
314
|
end
|
316
315
|
|
316
|
+
#this must be in helpers because getter class is not yet loaded at the time this method is needed.
|
317
|
+
def get_cheftacular_yml_as_hash
|
318
|
+
config_location = if File.exist?(File.join( Dir.getwd, 'config', 'cheftacular.yml' ))
|
319
|
+
File.join( Dir.getwd, 'config', 'cheftacular.yml' )
|
320
|
+
elsif File.exist?('/root/cheftacular.yml')
|
321
|
+
'/root/cheftacular.yml'
|
322
|
+
else
|
323
|
+
raise "cheftacular.yml configuration file could not be found in either #{ File.join( Dir.getwd, 'config', 'cheftacular.yml' ) } or /root/cheftacular.yml"
|
324
|
+
end
|
325
|
+
|
326
|
+
YAML::load(ERB.new(IO.read(File.open(config_location))).result)
|
327
|
+
rescue StandardError => e
|
328
|
+
puts "The cheftacular.yml configuration file could not be parsed."
|
329
|
+
puts "Error message: #{ e }\n#{ e.backtrace.join("\n") }"
|
330
|
+
|
331
|
+
exit
|
332
|
+
end
|
333
|
+
|
334
|
+
def current_chef_repo_cheftacular_file_cache_path
|
335
|
+
current_file_path "chef_repo_cheftacular_cache"
|
336
|
+
end
|
337
|
+
|
338
|
+
def write_chef_repo_cheftacular_cache_file hash
|
339
|
+
File.open( current_chef_repo_cheftacular_file_cache_path, "w") { |f| f.write(hash) }
|
340
|
+
end
|
341
|
+
|
342
|
+
def compile_chef_repo_cheftacular_yml_as_hash
|
343
|
+
master_hash = get_cheftacular_yml_as_hash
|
344
|
+
master_hash['replace_keys_in_chef_repo'].each_pair do |key, val|
|
345
|
+
master_hash[key] = val
|
346
|
+
end
|
347
|
+
|
348
|
+
master_hash
|
349
|
+
end
|
350
|
+
|
351
|
+
def write_chef_repo_cheftacular_yml_file file_location
|
352
|
+
File.open( file_location, "w") { |f| f.write(compile_chef_repo_cheftacular_yml_as_hash.to_yaml) }
|
353
|
+
end
|
354
|
+
|
317
355
|
private
|
318
356
|
def current_file_path file_name
|
319
357
|
File.join( @config['locs']['app-root'], 'tmp', declassify, "#{ Time.now.strftime("%Y%m%d") }-#{ file_name }")
|
@@ -48,9 +48,11 @@ class Cheftacular
|
|
48
48
|
|
49
49
|
@config['helper'].completion_rate? 100, 'initializer'
|
50
50
|
|
51
|
-
initialize_version_check if @config['cheftacular']['strict_version_checks']
|
51
|
+
initialize_version_check if @config['cheftacular']['strict_version_checks']
|
52
52
|
|
53
|
-
initialize_auditing_checks if @config['cheftacular']['auditing']
|
53
|
+
initialize_auditing_checks if @config['cheftacular']['auditing']
|
54
|
+
|
55
|
+
initialize_chef_repo_up_to_date if @config['cheftacular']['keep_chef_repo_cheftacular_yml_up_to_date']
|
54
56
|
end
|
55
57
|
|
56
58
|
#changes to arguments should show up in the documentation methods in their appropriate method file
|
@@ -212,20 +214,7 @@ class Cheftacular
|
|
212
214
|
end
|
213
215
|
|
214
216
|
def initialize_yaml_configuration
|
215
|
-
|
216
|
-
File.join( Dir.getwd, 'config', 'cheftacular.yml' )
|
217
|
-
elsif File.exist?('/root/cheftacular.yml')
|
218
|
-
'/root/cheftacular.yml'
|
219
|
-
else
|
220
|
-
raise "cheftacular.yml configuration file could not be found in either #{ File.join( Dir.getwd, 'config', 'cheftacular.yml' ) } or /root/cheftacular.yml"
|
221
|
-
end
|
222
|
-
|
223
|
-
@config['cheftacular'] = YAML::load(ERB.new(IO.read(File.open(config_location))).result)
|
224
|
-
rescue StandardError => e
|
225
|
-
puts "The cheftacular.yml configuration file could not be parsed."
|
226
|
-
puts "Error message: #{ e }\n#{ e.backtrace.join("\n") }"
|
227
|
-
|
228
|
-
exit
|
217
|
+
@config['cheftacular'] = @config['helper'].get_cheftacular_yml_as_hash
|
229
218
|
end
|
230
219
|
|
231
220
|
def initialize_default_cheftacular_options
|
@@ -299,7 +288,7 @@ class Cheftacular
|
|
299
288
|
client_name: (@config['helper'].running_on_chef_node? ? @config['helper'].parse_node_name_from_client_file : @config['cheftacular']['cheftacular_chef_user']),
|
300
289
|
client_key: File.expand_path("#{ @config['locs']['chef'] }/#{ @config['helper'].running_on_chef_node? ? 'client' : @config['cheftacular']['cheftacular_chef_user'] }.pem"),
|
301
290
|
encrypted_data_bag_secret: @config['data_bag_secret'],
|
302
|
-
ssl: { verify: @config['cheftacular']['ssl_verify']
|
291
|
+
ssl: { verify: @config['cheftacular']['ssl_verify'] }
|
303
292
|
)
|
304
293
|
end
|
305
294
|
|
@@ -393,7 +382,7 @@ class Cheftacular
|
|
393
382
|
if @config['helper'].is_higher_version? detected_version, current_version
|
394
383
|
puts "\n Your Cheftacular is out of date. Currently #{ current_version } and remote version is #{ detected_version }.\n"
|
395
384
|
|
396
|
-
puts "Please update the gemfile to #{ detected_version } and restart this process.\n"
|
385
|
+
puts "Please update the gemfile to #{ detected_version }, bundle install and then restart this process.\n"
|
397
386
|
|
398
387
|
exit
|
399
388
|
else
|
@@ -439,6 +428,39 @@ class Cheftacular
|
|
439
428
|
@config['helper'].cleanup_file_caches
|
440
429
|
end
|
441
430
|
|
431
|
+
def initialize_chef_repo_up_to_date
|
432
|
+
if @config['helper'].running_in_mode?('devops')
|
433
|
+
@config['cheftacular']['wrapper_cookbooks'].split(',').each do |wrapper_cookbook|
|
434
|
+
parsed_hash = if File.exists?( @config['helper'].current_chef_repo_cheftacular_file_cache_path )
|
435
|
+
File.read( @config['helper'].current_chef_repo_cheftacular_file_cache_path )
|
436
|
+
else
|
437
|
+
Digest::SHA2.hexdigest(@config['helper'].compile_chef_repo_cheftacular_yml_as_hash.to_yaml.to_s)
|
438
|
+
end
|
439
|
+
|
440
|
+
wrapper_cookbook_cheftacular_loc = "#{ @config['locs']['cookbooks'] }/#{ wrapper_cookbook }" +
|
441
|
+
@config['cheftacular']['location_of_chef_repo_cheftacular_yml'] + '/cheftacular.yml'
|
442
|
+
|
443
|
+
unless File.exist?(wrapper_cookbook_cheftacular_loc)
|
444
|
+
puts "Wrapper cookbook \"#{ wrapper_cookbook }\" does not have a cheftacular.yml file in #{ @config['cheftacular']['location_of_chef_repo_cheftacular_yml'] }! Creating..."
|
445
|
+
|
446
|
+
@config['helper'].write_chef_repo_cheftacular_yml_file wrapper_cookbook_cheftacular_loc
|
447
|
+
end
|
448
|
+
|
449
|
+
if parsed_hash == Digest::SHA2.hexdigest(File.read(wrapper_cookbook_cheftacular_loc))
|
450
|
+
next if File.exists?( @config['helper'].current_chef_repo_cheftacular_file_cache_path )
|
451
|
+
else
|
452
|
+
puts "Wrapper cookbook (#{ wrapper_cookbook }) does not have a current cheftacular.yml file in #{ @config['cheftacular']['location_of_chef_repo_cheftacular_yml'] }\"! Overwriting..."
|
453
|
+
|
454
|
+
@config['helper'].write_chef_repo_cheftacular_yml_file wrapper_cookbook_cheftacular_loc
|
455
|
+
end
|
456
|
+
|
457
|
+
puts "Creating file cache for #{ Time.now.strftime("%Y%m%d") }'s cheftacular.yml."
|
458
|
+
|
459
|
+
@config['helper'].write_chef_repo_cheftacular_cache_file parsed_hash
|
460
|
+
end
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
442
464
|
def initialize_bag_for_all_environments bag_name, total_percent=100
|
443
465
|
total_bags = @config['chef_environments'].count
|
444
466
|
current_bags = 1
|
data/lib/cheftacular/parser.rb
CHANGED
@@ -191,9 +191,9 @@ class Cheftacular
|
|
191
191
|
|
192
192
|
def parse_to_dns dns_string
|
193
193
|
raise "Unable to parse DNS without @option['node_name'] for #{ dns_string }!" if dns_string.include?('NODE_NAME') && @options['node_name'].nil?
|
194
|
-
raise "Unable to parse DNS without a tld set in the config bag for #{ @options['env'] }!" if dns_string.include?('ENV_TLD') && @config[@options['env']]['config_bag_hash']['tld'].nil?
|
194
|
+
raise "Unable to parse DNS without a tld set in the config bag for #{ @options['env'] }!" if dns_string.include?('ENV_TLD') && @config[@options['env']]['config_bag_hash'][@options['sub_env']]['tld'].nil?
|
195
195
|
|
196
|
-
dns_string.gsub('NODE_NAME', @options['node_name']).gsub('ENV_TLD', @config[@options['env']]['config_bag_hash']['tld'])
|
196
|
+
dns_string.gsub('NODE_NAME', @options['node_name']).gsub('ENV_TLD', @config[@options['env']]['config_bag_hash'][@options['sub_env']]['tld'])
|
197
197
|
end
|
198
198
|
|
199
199
|
def parse_repository_hash_from_string string
|
@@ -48,7 +48,7 @@ class Cheftacular
|
|
48
48
|
|
49
49
|
'2. `-z|--unset-revision` will unset a custom revision specified in the arg below and make the codebase utilize the default.',
|
50
50
|
|
51
|
-
"3. `-Z|--revision REVISION` will force the role you're deploying to to utilize the revision specified here. This can be a specific commit
|
51
|
+
"3. `-Z|--revision REVISION` will force the role you're deploying to to utilize the revision specified here. This can be a specific commit, a branch name or even a tag.",
|
52
52
|
|
53
53
|
' 1. Note: The system does not check if the revision exists, if you pass a non-existent revision no one will be able to deploy to that role until -Z with a correction revision or -z is passed.'
|
54
54
|
]
|
@@ -51,7 +51,7 @@ class Cheftacular
|
|
51
51
|
|
52
52
|
final_commands = []
|
53
53
|
|
54
|
-
if @config['cheftacular']['install_rvm_on_boot']
|
54
|
+
if @config['cheftacular']['install_rvm_on_boot']
|
55
55
|
deploy_commands << "gpg --keyserver hkp://keys.gnupg.net --recv-keys #{ @config['cheftacular']['rvm_gpg_key'] }"
|
56
56
|
deploy_commands << "curl -L https://get.rvm.io | bash -s stable"
|
57
57
|
|
@@ -27,17 +27,17 @@ class Cheftacular
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
compiled_audit_hash.
|
30
|
+
compiled_audit_hash.keys.sort.each do |day|
|
31
31
|
out << "# Audit Log Entries for #{ Date.parse(day) }"
|
32
32
|
|
33
33
|
entry_count, int_times = 1, []
|
34
34
|
|
35
|
-
|
35
|
+
compiled_audit_hash[day].keys.each do |time|
|
36
36
|
out << "#{ entry_count }. #{ time }"
|
37
37
|
|
38
38
|
log_array_entry_count = 1
|
39
39
|
|
40
|
-
|
40
|
+
compiled_audit_hash[day][time].each do |log_arr|
|
41
41
|
log_arr.each do |log_hash|
|
42
42
|
out << " #{ log_array_entry_count }. #{ log_hash['command'] }"
|
43
43
|
out << " 1. Hostname: #{ log_hash['hostname'] }"
|
@@ -47,7 +47,7 @@ class Cheftacular
|
|
47
47
|
|
48
48
|
log_array_entry_count += 1
|
49
49
|
end
|
50
|
-
end if
|
50
|
+
end if compiled_audit_hash[day].has_key?(time)
|
51
51
|
|
52
52
|
entry_count += 1
|
53
53
|
end
|
@@ -38,7 +38,7 @@ class Cheftacular
|
|
38
38
|
@options['force_yes'] = true
|
39
39
|
@options['in_scaling'] = true
|
40
40
|
|
41
|
-
initial_servers = @config['cheftacular']['env_boot_nodes']["#{ @options['env'] }
|
41
|
+
initial_servers = @config['cheftacular']['env_boot_nodes']["#{ @options['env'] }_nodes"]
|
42
42
|
|
43
43
|
if initial_servers.empty?
|
44
44
|
puts "There are no servers defined for #{ @options['env'] } in the env_boot_nodes hash in your cheftacular.yml... Exiting"
|
@@ -49,12 +49,12 @@ class Cheftacular
|
|
49
49
|
case type
|
50
50
|
when 'boot'
|
51
51
|
initial_servers.each_pair do |name, config_hash|
|
52
|
+
next if nodes.map { |n| n.name }.include?(name)
|
53
|
+
|
52
54
|
@options['node_name'] = name
|
53
55
|
@options['flavor_name'] = config_hash.has_key?('flavor') ? config_hash['flavor'] : @config['cheftacular']['default_flavor_name']
|
54
56
|
@options['descriptor'] = config_hash.has_key?('descriptor') ? config_hash['descriptor'] : name
|
55
57
|
@options['with_dn'] = config_hash.has_key?('dns_config') ? @config['parser'].parse_to_dns(config_hash['dns_config']) : @config['parser'].parse_to_dns('NODE_NAME.ENV_TLD')
|
56
|
-
|
57
|
-
next if nodes.map { |n| n.name }.include?(@options['node_name'])
|
58
58
|
|
59
59
|
puts("Preparing to boot server #{ @options['node_name'] } for #{ @options['env'] }!") unless @options['quiet']
|
60
60
|
|
@@ -91,7 +91,7 @@ class Cheftacular
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
if @config['cheftacular']['git_based_deploys']
|
94
|
+
if @config['cheftacular']['git_based_deploys']
|
95
95
|
if !hash.has_key?('git_private_key') || !hash.has_key?('git_public_key') || !hash.has_key?('git_OAuth')
|
96
96
|
puts "Warning! github user credentials in default authentication bag were not found! Please run `cft help create_git_key` and then run that command itself!" unless @command == 'help'
|
97
97
|
end
|
@@ -161,8 +161,8 @@ class Cheftacular
|
|
161
161
|
|
162
162
|
config_fix_message = "\n\n knife data bag edit #{ main_env } config\n\n"
|
163
163
|
|
164
|
-
if @config['cheftacular']['
|
165
|
-
@config['cheftacular']['
|
164
|
+
if @config['cheftacular']['run_list_environments'].has_key?(main_env)
|
165
|
+
@config['cheftacular']['run_list_environments'][main_env].each_value do |sub_env|
|
166
166
|
envs_to_build_in_hash << sub_env
|
167
167
|
end
|
168
168
|
end
|
@@ -30,7 +30,9 @@ class Cheftacular
|
|
30
30
|
|
31
31
|
type = ARGV[env_index] if ARGV[env_index]
|
32
32
|
|
33
|
-
|
33
|
+
split_envs = @config['cheftacular']['run_list_environments'][@options['env']]
|
34
|
+
|
35
|
+
raise "Unknown split_env: #{ split_env }, can only be #{ split_envs.values.join(', ') }" unless (split_env =~ /#{ split_envs.values.join('|') }/) == 0
|
34
36
|
|
35
37
|
raise "Unknown type: #{ type }, can only be 'boot' or 'destroy'" unless (type =~ /boot|destroy/) == 0
|
36
38
|
|
@@ -44,7 +46,9 @@ class Cheftacular
|
|
44
46
|
case type
|
45
47
|
when 'boot'
|
46
48
|
@config['cheftacular']['split_env_nodes'].each_pair do |name, config_hash|
|
47
|
-
|
49
|
+
config_hash ||= {}
|
50
|
+
true_name = name.gsub('SPLITENV', split_env)
|
51
|
+
@options['sub_env'] = split_env
|
48
52
|
@options['node_name'] = "#{ true_name }#{ 'p' if @options['env'] == 'production' }"
|
49
53
|
@options['flavor_name'] = config_hash.has_key?('flavor') ? config_hash['flavor'] : @config['cheftacular']['default_flavor_name']
|
50
54
|
@options['descriptor'] = config_hash.has_key?('descriptor') ? "#{ config_hash['descriptor'] }-#{ split_env }" : name
|
@@ -48,10 +48,12 @@ class Cheftacular
|
|
48
48
|
"git fetch origin",
|
49
49
|
]
|
50
50
|
|
51
|
-
@config['run_list_environments'].
|
52
|
-
|
51
|
+
@config['run_list_environments'].each_pair do |env, branch_hash|
|
52
|
+
branch_hash.keys.each do |branch_name|
|
53
|
+
true_branch_name = branch_name.gsub('_','-')
|
53
54
|
|
54
|
-
|
55
|
+
commands << ["git checkout #{ true_branch_name }", "git pull origin #{ true_branch_name }", 'git merge master --no-edit', "git push origin #{ true_branch_name }"]
|
56
|
+
end
|
55
57
|
end
|
56
58
|
|
57
59
|
commands << "git checkout #{ current_revision }"
|
data/lib/cheftacular/version.rb
CHANGED
@@ -3,7 +3,7 @@ module SSHKit
|
|
3
3
|
class Netssh
|
4
4
|
def start_task name, ip_address, run_list, command, options, locs, cheftacular, out=""
|
5
5
|
log_loc, timestamp = set_log_loc_and_timestamp(locs)
|
6
|
-
true_env = get_true_environment run_list, cheftacular['run_list_environments'], options['env']
|
6
|
+
true_env = get_true_environment run_list, cheftacular['run_list_environments'][options['env']], options['env']
|
7
7
|
|
8
8
|
puts "Running #{ command } for #{ name } (#{ ip_address }) (Run with with --debug to generate a log as well)"
|
9
9
|
|
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.
|
4
|
+
version: 2.4.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-
|
11
|
+
date: 2015-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|