cheftacular 2.0.7 → 2.0.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dab07a85b0c1c0d66ad4c40632410460e12cb085
|
4
|
+
data.tar.gz: 0ea6a7fd5c2cc3ec3599b96dae67aa6124db2645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30c885801868c04eb02fc1679457c35ad755b785c74a906ac44e98fc60c9e01e27af59d01561204fb9e156dadd4d5c66953edfa46d78e44141ea751d29c8fda6
|
7
|
+
data.tar.gz: 4aa577cba2465797c2a1991868e54e5559cb92bbab65dca30ac544a637543252d6f72fceebfaa7f1caaa1934cfde2be1613ddbb5243922fa3e264ea05fad70a1
|
@@ -36,8 +36,8 @@ class Cheftacular
|
|
36
36
|
|
37
37
|
puts("Beginning log fetch run for #{ n.name } (#{ n.public_ipaddress }) on role #{ options['role'] }") unless options['quiet']
|
38
38
|
|
39
|
-
if
|
40
|
-
start_log_role_map( name, n.public_ipaddress, getter.get_current_role_map['log_location'], options, locs, cheftacular, passwords)
|
39
|
+
if has_run_list_in_role_map?(n.run_list, cheftacular['role_maps'])
|
40
|
+
start_log_role_map( n.name, n.public_ipaddress, getter.get_current_role_map(n.run_list)['log_location'], options, locs, cheftacular, passwords)
|
41
41
|
else
|
42
42
|
self.send("start_log_fetch_#{ getter.get_current_stack }", n.name, n.public_ipaddress, n.run_list, options, locs, cheftacular, passwords)
|
43
43
|
end
|
@@ -26,9 +26,8 @@ class Cheftacular
|
|
26
26
|
nodes.each do |n|
|
27
27
|
puts("Beginning tail run for #{ n.name } (#{ n.public_ipaddress }) on role #{ @options['role'] }") unless @options['quiet']
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
start_tail_role_map( n.public_ipaddress )
|
29
|
+
if @config['dummy_sshkit'].has_run_list_in_role_map?(n.run_list, @config['cheftacular']['role_maps'])
|
30
|
+
start_tail_role_map( n.public_ipaddress, n.run_list )
|
32
31
|
else
|
33
32
|
self.send("start_tail_#{ @config['getter'].get_current_stack }", n.public_ipaddress, n.run_list )
|
34
33
|
end
|
@@ -37,8 +36,8 @@ class Cheftacular
|
|
37
36
|
|
38
37
|
private
|
39
38
|
|
40
|
-
def start_tail_role_map ip_address
|
41
|
-
log_loc = @config['getter'].get_current_role_map['log_location'].split(',').first
|
39
|
+
def start_tail_role_map ip_address, run_list
|
40
|
+
log_loc = @config['getter'].get_current_role_map(run_list)['log_location'].split(',').first.gsub('|current_repo_location|', "#{ @config['cheftacular']['base_file_path'] }/#{ @options['repository'] }/current")
|
42
41
|
|
43
42
|
`ssh -oStrictHostKeyChecking=no -tt deploy@#{ ip_address } "#{ @config['helper'].sudo(ip_address) } tail -f #{ log_loc }" > /dev/tty`
|
44
43
|
end
|
data/lib/cheftacular/getters.rb
CHANGED
@@ -103,9 +103,9 @@ class Cheftacular
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
def get_current_role_map ret=
|
106
|
+
def get_current_role_map run_list, ret={}
|
107
107
|
@config['cheftacular']['role_maps'].each_pair do |main_role, role_hash|
|
108
|
-
ret = role_hash if role_hash['role_name']
|
108
|
+
ret = role_hash if run_list.include?("role[#{ role_hash['role_name'] }]")
|
109
109
|
end
|
110
110
|
|
111
111
|
ret
|
data/lib/cheftacular/version.rb
CHANGED
@@ -5,23 +5,24 @@ module SSHKit
|
|
5
5
|
log_loc, timestamp = set_log_loc_and_timestamp(locs)
|
6
6
|
log_cmnd, log_lines = get_log_command_and_lines(options)
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
puts "Fetching log file(s) for #{ name } (#{ ip_address }). Outputting to #{ log_loc } with timestamp: #{ timestamp }"
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
target_log_loc.split(',').each do |parsed_log_loc|
|
12
|
+
parsed_log_loc = parsed_log_loc.gsub('|current_repo_location|', "#{ cheftacular['base_file_path'] }/#{ options['repository'] }/current")
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
if parsed_log_loc != '/var/log/syslog' && !test("[ -e #{ parsed_log_loc }]") #true if file exists ()
|
15
|
+
puts "#{ name } (#{ ip_address }) does not have a #{ parsed_log_loc } log file for #{ options['env'] } at the moment..."
|
16
|
+
else
|
16
17
|
if log_lines.nil?
|
17
18
|
out << sudo_capture(passwords[ip_address], log_cmnd.to_sym, parsed_log_loc)
|
18
19
|
|
19
20
|
else
|
20
21
|
out << sudo_capture(passwords[ip_address], log_cmnd.to_sym, log_lines, parsed_log_loc)
|
21
22
|
end
|
22
|
-
end
|
23
23
|
|
24
|
-
|
24
|
+
::File.open("#{ log_loc }/#{ name }-#{ parsed_log_loc.split('/').last.split('.').first }-#{ timestamp }.txt", "w") { |f| f.write(out.scrub_pretty_text) } unless options['no_logs']
|
25
|
+
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
data/lib/sshkit/helpers.rb
CHANGED
@@ -8,6 +8,14 @@ module SSHKit
|
|
8
8
|
def sudo_capture pass, *args
|
9
9
|
capture :echo, pass, :|, :sudo, '-S', *args
|
10
10
|
end
|
11
|
+
|
12
|
+
def has_run_list_in_role_map? run_list, role_map_hash
|
13
|
+
role_map_hash.each_value do |map_hash|
|
14
|
+
return true if run_list.include?("role[#{ map_hash['role_name'] }]")
|
15
|
+
end
|
16
|
+
|
17
|
+
false
|
18
|
+
end
|
11
19
|
end
|
12
20
|
end
|
13
21
|
end
|