cheftacular 2.13.2 → 2.14.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/README.md +31 -17
- data/lib/cheftacular/action.rb +2 -0
- data/lib/cheftacular/actions/check.rb +9 -3
- data/lib/cheftacular/actions/db_console.rb +26 -5
- data/lib/cheftacular/actions/deploy.rb +14 -3
- data/lib/cheftacular/actions/migrate.rb +1 -1
- data/lib/cheftacular/actions/verify.rb +20 -0
- data/lib/cheftacular/helper.rb +3 -1
- data/lib/cheftacular/initialization_action.rb +2 -0
- data/lib/cheftacular/parser.rb +18 -0
- data/lib/cheftacular/stateless_action.rb +1 -0
- data/lib/cheftacular/stateless_actions/pass.rb +3 -2
- data/lib/cheftacular/stateless_actions/ssh.rb +40 -0
- data/lib/cheftacular/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 691c10d8f335d581eee5c51c26d573348d1fba52
|
4
|
+
data.tar.gz: 8f2ef29f362b2f9f4eeedc1da079fc7f5f68f5eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c33b2dfa6a1c1dd0feed92c44b3e14c6fb4acb2e8a5cf45f4b1d598ed0c969d630eac266b31b0abe62510d4e9bc93b9bcb29fd5bdec2e33399ab005aad26fc9e
|
7
|
+
data.tar.gz: f85efd25195630c862b2dd0ab477ab7a2a049bf604360c736774be10053d52ea39954763cc9a98032b6d6ffd75c62c60a11b8a5e8961734d20f1fc86ed1cdc98
|
data/lib/cheftacular/README.md
CHANGED
@@ -86,13 +86,15 @@
|
|
86
86
|
|
87
87
|
6. By default, the backups command will use the context of your current environment to trigger backup related commands.
|
88
88
|
|
89
|
-
2. `cft check [all]` Checks the commits for all servers for a repository (for an environment) and returns them in a simple chart. Also shows when these commits were deployed to the server.
|
89
|
+
2. `cft check [all|verify]` Checks the commits for all servers for a repository (for an environment) and returns them in a simple chart. Also shows when these commits were deployed to the server.
|
90
90
|
|
91
91
|
1. If the node has special repository based keys from TheCheftacularCookbook, this command will also display information about the branch and organization currently deployed to the node(s).
|
92
92
|
|
93
93
|
2. If the all argument is provided, all repositories will be checked for the current environment
|
94
94
|
|
95
|
-
3.
|
95
|
+
3. If the verify argument is provided, cft will attempt to see if the servers are using the latest commits
|
96
|
+
|
97
|
+
4. Aliased to `cft ch`
|
96
98
|
|
97
99
|
3. `cft chef_server [restart|processes|memory]` this command can be used to query the chef server for stats if the cheftacular.yml has the chef_server key filled out. Useful for low resource chef-servers.
|
98
100
|
|
@@ -160,7 +162,7 @@
|
|
160
162
|
|
161
163
|
2. This command is also aliased to mongo, typing `cft mongo` will drop you into a mongodb mongo session.
|
162
164
|
|
163
|
-
11. `cft deploy` will do a simple chef-client run on the servers for a role. Logs of the run itself will be sent to the local log directory in the application (or chef-repo) where the run was conducted.
|
165
|
+
11. `cft deploy [check|verify]` will do a simple chef-client run on the servers for a role. Logs of the run itself will be sent to the local log directory in the application (or chef-repo) where the run was conducted.
|
164
166
|
|
165
167
|
1. The `-Z REVISION` flag can be used with TheCheftacularCookbook to set a revision your app will run.
|
166
168
|
|
@@ -172,7 +174,11 @@
|
|
172
174
|
|
173
175
|
5. The `-v|--verbose` option will cause failed deploys to output to the terminal window and to their normal log file. Useful for debugging.
|
174
176
|
|
175
|
-
6.
|
177
|
+
6. The `cft deploy check` argument will force a check run under the same environment as the initial deploy.
|
178
|
+
|
179
|
+
7. The `cft deploy verify` argument will force a check AND verify run under the same environment as the initial deploy
|
180
|
+
|
181
|
+
8. Aliased to `cft d`
|
176
182
|
|
177
183
|
12. `cft disk_report` will fetch useful statistics from every server for every environment and output it into your log directory.
|
178
184
|
|
@@ -296,7 +302,9 @@
|
|
296
302
|
|
297
303
|
1. In the case of server creation, this command takes a great deal of time to execute. It will output what stage it is currently on to the terminal but <b>you must not kill this command while it is executing</b>.A failed build may require the server to be destroyed / examined by a DevOps engineer.
|
298
304
|
|
299
|
-
29. `cft
|
305
|
+
29. `cft ssh NODE_NAME` ssh you into the node name you are trying to access. It will also drop the server's sudo password into your clipboard.
|
306
|
+
|
307
|
+
30. `cft tail [PATTERN_TO_MATCH]` will tail the logs (return continuous output) of the first node if finds that has an application matching the repository running on it. Currently only supports rails stacks
|
300
308
|
|
301
309
|
1. pass `-n NODE_NAME` to grab the output of a node other than the first.
|
302
310
|
|
@@ -304,9 +312,13 @@
|
|
304
312
|
|
305
313
|
3. if the `PATTERN_TO_MATCH` argument exists, the tail will only return entries that have that pattern rather than everything written to the file.
|
306
314
|
|
307
|
-
|
315
|
+
31. `cft update_cheftacular` this command attempts to update cheftacular to the latest version.
|
308
316
|
|
309
|
-
|
317
|
+
32. `cft verify` Checks to see if the servers for the current state are running the latest commits.
|
318
|
+
|
319
|
+
1. This command is functionally the same as `cft check verify`.
|
320
|
+
|
321
|
+
33. `cft version` this command prints out the current version of cheftacular.
|
310
322
|
|
311
323
|
1. Aliased to `cft v`
|
312
324
|
|
@@ -667,7 +679,9 @@
|
|
667
679
|
|
668
680
|
2. Remember, if you have auditing turned on in your cheftacular.yml, you can track who sends what to slack.
|
669
681
|
|
670
|
-
44. `cft
|
682
|
+
44. `cft ssh NODE_NAME` ssh you into the node name you are trying to access. It will also drop the server's sudo password into your clipboard.
|
683
|
+
|
684
|
+
45. `cft test_env [TARGET_ENV] boot|destroy` will create (or destroy) the test nodes for a particular environment (defaults to staging, prod split-envs can be set with `-p`). Please read below for how TARGET_ENV works
|
671
685
|
|
672
686
|
1. TARGET_ENV changes functionality depending on the overall (like staging / production) environment
|
673
687
|
|
@@ -677,11 +691,11 @@
|
|
677
691
|
|
678
692
|
3. The default tld used should change depending on which environment you are booting / destroying. This is set in the environment's config data bag under the tld key
|
679
693
|
|
680
|
-
|
694
|
+
46. `cft ubuntu_bootstrap_from_queue` This command will bring a fresh server to a state where chef-client can be run on it via `cft chef-bootstrap`. It should be noted that it is in this step where a server's randomized deploy_user sudo password is generated.
|
681
695
|
|
682
|
-
|
696
|
+
47. `cft update_cheftacular` this command attempts to update cheftacular to the latest version.
|
683
697
|
|
684
|
-
|
698
|
+
48. `cft update_cloudflare_dns_from_cloud [skip_update_tld]` command will force a full dns update for cloudflare.
|
685
699
|
|
686
700
|
1. It will ensure all the subdomain entries are correct (based on the contents of the addresses data bag) and update them if they are not. It will also create the local subdomain for the entry as well if it does exist and point it to the correct private address for an environment.
|
687
701
|
|
@@ -689,13 +703,13 @@
|
|
689
703
|
|
690
704
|
3. The argument `skip_update_tld` will stop the long process of checking and updating all the server domains _before_ cloudflare is updated. Only skip if you believe your domain info on your cloud is accurate.
|
691
705
|
|
692
|
-
|
706
|
+
49. `cft update_cookbook [COOKBOOK_NAME] [INSTALL_VERSION]` allows you to specifically update a single cookbook
|
693
707
|
|
694
708
|
1. This command passed with no arguments will update TheCheftacularCookbook
|
695
709
|
|
696
710
|
2. Aliased to `cft uc`
|
697
711
|
|
698
|
-
|
712
|
+
50. `cft update_split_branches` will perform a series of git commands that will merge all the split branches for your split_branch enabled repositories with what is currently on master and push them.
|
699
713
|
|
700
714
|
1. Repository must be set with `-R REPOSITORY_NAME` for this command to work.
|
701
715
|
|
@@ -705,9 +719,9 @@
|
|
705
719
|
|
706
720
|
4. This command will return a helpful error statement if you attempt to run the command with changes to your current working directory. You must commit these changes before running this command.
|
707
721
|
|
708
|
-
|
722
|
+
51. `cft update_tld TLD` command will force a full dns update for a tld in the preferred cloud. It will ensure all the subdomain entries are correct (based on the contents of the addresses data bag) and update them if they are not. It will also create the local subdomain for the entry as well if it does exist and point it to the correct private address.
|
709
723
|
|
710
|
-
|
724
|
+
52. `cft upload_nodes` This command will resync the chef server's nodes with the data in our chef-repo/node_roles.
|
711
725
|
|
712
726
|
1. This command changes behavior depending on several factors about both your mode and the state of your environment
|
713
727
|
|
@@ -721,10 +735,10 @@
|
|
721
735
|
|
722
736
|
4. Aliased to `cft un`
|
723
737
|
|
724
|
-
|
738
|
+
53. `cft upload_roles` This command will resync the chef server's roles with the data in the chef-repo/roles.
|
725
739
|
|
726
740
|
1. Aliased to `cft ur`
|
727
741
|
|
728
|
-
|
742
|
+
54. `cft version` this command prints out the current version of cheftacular.
|
729
743
|
|
730
744
|
1. Aliased to `cft v`
|
data/lib/cheftacular/action.rb
CHANGED
@@ -3,7 +3,7 @@ class Cheftacular
|
|
3
3
|
def check
|
4
4
|
@config['documentation']['action'][__method__] ||= {}
|
5
5
|
@config['documentation']['action'][__method__]['long_description'] = [
|
6
|
-
"`cft check [all]` Checks the commits for all servers for a repository (for an environment) and returns them in a simple chart. " +
|
6
|
+
"`cft check [all|verify]` Checks the commits for all servers for a repository (for an environment) and returns them in a simple chart. " +
|
7
7
|
"Also shows when these commits were deployed to the server.",
|
8
8
|
[
|
9
9
|
" 1. If the node has special repository based keys from TheCheftacularCookbook, this command will also display information " +
|
@@ -11,7 +11,9 @@ class Cheftacular
|
|
11
11
|
|
12
12
|
" 2. If the all argument is provided, all repositories will be checked for the current environment",
|
13
13
|
|
14
|
-
" 3.
|
14
|
+
" 3. If the verify argument is provided, cft will attempt to see if the servers are using the latest commits",
|
15
|
+
|
16
|
+
" 4. Aliased to `cft ch`"
|
15
17
|
]
|
16
18
|
]
|
17
19
|
@config['documentation']['action'][__method__]['short_description'] = "Checks the branches currently deployed to an env for your repo"
|
@@ -19,10 +21,12 @@ class Cheftacular
|
|
19
21
|
end
|
20
22
|
|
21
23
|
class Action
|
22
|
-
def check commit_hash={}, have_revisions=false, have_changed_orgs=false, fetch_all_repository_data=false, headers=[], deployment_args={ in: :parallel }
|
24
|
+
def check mode='', commit_hash={}, have_revisions=false, have_changed_orgs=false, fetch_all_repository_data=false, headers=[], deployment_args={ in: :parallel }
|
23
25
|
@config['filesystem'].cleanup_file_caches('current-nodes')
|
24
26
|
|
25
27
|
fetch_all_repository_data = ARGV[1] == 'all'
|
28
|
+
verify_state_is_latest = ARGV[1] == 'verify'
|
29
|
+
verify_state_is_latest = mode == 'verify' if ARGV[1] != 'verify'
|
26
30
|
|
27
31
|
nodes = @config['getter'].get_true_node_objects(fetch_all_repository_data)
|
28
32
|
|
@@ -86,6 +90,8 @@ class Cheftacular
|
|
86
90
|
end
|
87
91
|
end
|
88
92
|
end
|
93
|
+
|
94
|
+
@config['helper'].check_if_possible_repo_state(@config['parser'].parse_repo_state_hash_from_commit_hash(commit_hash), 'display_for_check') if verify_state_is_latest
|
89
95
|
end
|
90
96
|
|
91
97
|
alias_method :ch, :check
|
@@ -39,16 +39,22 @@ class Cheftacular
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def db_console_mongodb
|
42
|
+
def db_console_mongodb private_database_host_address=nil
|
43
43
|
nodes = @config['getter'].get_true_node_objects(true)
|
44
44
|
|
45
45
|
#must have mongo db, only want ONE node
|
46
|
+
if @config['getter'].get_current_repo_config.has_key?('db_primary_host_role')
|
47
|
+
mongo_host = @config['parser'].exclude_nodes( nodes, [{ unless: "role[#{ @config['getter'].get_current_repo_config['db_primary_host_role'] }]"}, { if: { not_env: @options['env'] } }], true).first
|
48
|
+
|
49
|
+
private_database_host_address = @config['getter'].get_address_hash(mongo_host.name)[mongo_host.name]['priv']
|
50
|
+
end
|
51
|
+
|
46
52
|
mongoable_nodes = @config['parser'].exclude_nodes( nodes, [{ unless: "role[#{ @options['role'] }]" }, { if: { not_env: @options['env'] } }], true )
|
47
53
|
|
48
54
|
mongoable_nodes.each do |n|
|
49
55
|
puts("Beginning database console run for #{ n.name } (#{ n.public_ipaddress }) on role #{ @options['role'] }") unless @options['quiet']
|
50
56
|
|
51
|
-
start_console_mongodb(n.public_ipaddress)
|
57
|
+
start_console_mongodb(n.public_ipaddress, private_database_host_address)
|
52
58
|
end
|
53
59
|
end
|
54
60
|
|
@@ -81,13 +87,28 @@ class Cheftacular
|
|
81
87
|
end
|
82
88
|
|
83
89
|
#the >/dev/tty after the ssh block redirects the full output to stdout, not /dev/null where it normally goes
|
84
|
-
`ssh
|
90
|
+
`ssh #{ Cheftacular::SSH_INLINE_VARS } -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "PGPASSWORD=#{ pg_pass } psql -U #{ db_user } -h #{ database_host } -d #{ db_name }" > /dev/tty`
|
85
91
|
end
|
86
92
|
|
87
|
-
def start_console_mongodb ip_address
|
93
|
+
def start_console_mongodb ip_address, database_host
|
94
|
+
unless database_host.nil?
|
95
|
+
mongo_pass = @config[@options['env']]['chef_passwords_bag_hash'][@options['repository']]['mongo_pass'] if @config[@options['env']]['chef_passwords_bag_hash'][@options['repository']].has_key?('mongo_pass')
|
96
|
+
mongo_pass ||= @config[@options['env']]['chef_passwords_bag_hash']['mongo_pass']
|
97
|
+
db_user = @config['getter'].get_current_repo_config['application_database_user']
|
98
|
+
db_name = if @config['getter'].get_current_repo_config.has_key?('custom_database_name')
|
99
|
+
@config['getter'].get_current_repo_config['custom_database_name']
|
100
|
+
else
|
101
|
+
"#{ @config['getter'].get_current_repo_config['repo_name'] }_#{ @options['env'] }"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
88
105
|
#the >/dev/tty after the ssh block redirects the full output to stdout, not /dev/null where it normally goes
|
89
106
|
#TODO refactor to more general solution (path / port)
|
90
|
-
|
107
|
+
if database_host.nil?
|
108
|
+
`ssh #{ Cheftacular::SSH_INLINE_VARS } -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "mongo localhost:27017/mongodb" > /dev/tty`
|
109
|
+
else
|
110
|
+
`ssh #{ Cheftacular::SSH_INLINE_VARS } -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "mongo #{ @options['repository'] } --username #{ db_user } --password #{ mongo_pass } --host #{ database_host } --port 27017" > /dev/tty`
|
111
|
+
end
|
91
112
|
end
|
92
113
|
|
93
114
|
def start_console_mysql
|
@@ -3,7 +3,7 @@ class Cheftacular
|
|
3
3
|
def deploy
|
4
4
|
@config['documentation']['action'][__method__] ||= {}
|
5
5
|
@config['documentation']['action'][__method__]['long_description'] = [
|
6
|
-
"`cft deploy` will do a simple chef-client run on the servers for a role. " +
|
6
|
+
"`cft deploy [check|verify]` will do a simple chef-client run on the servers for a role. " +
|
7
7
|
"Logs of the run itself will be sent to the local log directory in the application (or chef-repo) where the run was conducted.",
|
8
8
|
|
9
9
|
[
|
@@ -19,7 +19,11 @@ class Cheftacular
|
|
19
19
|
|
20
20
|
" 5. The `-v|--verbose` option will cause failed deploys to output to the terminal window and to their normal log file. Useful for debugging.",
|
21
21
|
|
22
|
-
" 6.
|
22
|
+
" 6. The `cft deploy check` argument will force a check run under the same environment as the initial deploy.",
|
23
|
+
|
24
|
+
" 7. The `cft deploy verify` argument will force a check AND verify run under the same environment as the initial deploy",
|
25
|
+
|
26
|
+
" 8. Aliased to `cft d`"
|
23
27
|
]
|
24
28
|
]
|
25
29
|
|
@@ -29,6 +33,9 @@ class Cheftacular
|
|
29
33
|
|
30
34
|
class Action
|
31
35
|
def deploy deployment_args={ in: :groups, limit: 6, wait: 5 }
|
36
|
+
run_check = ARGV[1] == 'check'
|
37
|
+
run_verify = ARGV[1] == 'verify'
|
38
|
+
|
32
39
|
nodes = @config['getter'].get_true_node_objects(false) #when this is run in scaling we'll need to make sure we deploy to new nodes
|
33
40
|
|
34
41
|
nodes = @config['parser'].exclude_nodes( nodes, [{ if: "role[#{ @options['negative_role'] }]" }]) if @options['negative_role']
|
@@ -55,7 +62,11 @@ class Cheftacular
|
|
55
62
|
|
56
63
|
@config['ChefDataBag'].save_logs_bag unless @options['debug'] #We don't really need to store entire chef runs in the logs bag
|
57
64
|
|
58
|
-
|
65
|
+
@config['action'].check if run_check && !@options['run_migration_already']
|
66
|
+
|
67
|
+
@config['action'].check('verify') if run_verify && !@options['run_migration_already']
|
68
|
+
|
69
|
+
@config['action'].migrate(nodes) if @config['getter'].get_current_repo_config['database'] != 'none' && !@options['run_migration_already']
|
59
70
|
|
60
71
|
split_nodes_hash = {}
|
61
72
|
|
@@ -51,7 +51,7 @@ class Cheftacular
|
|
51
51
|
if !log_data.empty? && log_data != @config['cheftacular']['repositories'][@options['role']]['not_a_migration_message']
|
52
52
|
@config['auditor'].notify_slack_on_completion("migrate run completed\n") if @config['cheftacular']['auditing']
|
53
53
|
|
54
|
-
deploy
|
54
|
+
@config['action'].deploy
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Cheftacular
|
2
|
+
class ActionDocumentation
|
3
|
+
def verify
|
4
|
+
@config['documentation']['action'][__method__] ||= {}
|
5
|
+
@config['documentation']['action'][__method__]['long_description'] = [
|
6
|
+
"`cft verify` Checks to see if the servers for the current state are running the latest commits. ",
|
7
|
+
[
|
8
|
+
" 1. This command is functionally the same as `cft check verify`."
|
9
|
+
]
|
10
|
+
]
|
11
|
+
@config['documentation']['action'][__method__]['short_description'] = "Checks the commits currently deployed to an env for your repo"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Action
|
16
|
+
def verify
|
17
|
+
@config['action'].check('verify')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/cheftacular/helper.rb
CHANGED
@@ -287,7 +287,7 @@ class Cheftacular
|
|
287
287
|
return_hash
|
288
288
|
end
|
289
289
|
|
290
|
-
def check_if_possible_repo_state repo_state_hash, git_output=''
|
290
|
+
def check_if_possible_repo_state repo_state_hash, output_mode='silent', git_output=''
|
291
291
|
revision_to_check = repo_state_hash.has_key?('revision') ? repo_state_hash['revision'] : nil
|
292
292
|
org_name_to_check = repo_state_hash.has_key?('deploy_organization') ? repo_state_hash['deploy_organization'] : @config['cheftacular']['TheCheftacularCookbook']['organization_name']
|
293
293
|
|
@@ -318,6 +318,8 @@ class Cheftacular
|
|
318
318
|
puts "Please verify the correct revision / branch and run this command again."
|
319
319
|
|
320
320
|
exit
|
321
|
+
elsif git_output.include?(revision_to_check) && output_mode == 'display_for_check'
|
322
|
+
puts "\nSuccessfully verified that the commit #{ repo_state_hash['revision'] } is the latest for the branch #{ repo_state_hash['branch'] } in organization #{ repo_state_hash['deploy_organization'] }.\n"
|
321
323
|
end
|
322
324
|
end
|
323
325
|
|
data/lib/cheftacular/parser.rb
CHANGED
@@ -237,5 +237,23 @@ class Cheftacular
|
|
237
237
|
|
238
238
|
"#{ domain.trd }.#{ domain.domain }"
|
239
239
|
end
|
240
|
+
|
241
|
+
def parse_repo_state_hash_from_commit_hash commit_hash, repo_state_hash={'revision' => [], 'deploy_organization' => [], 'branch' => []}
|
242
|
+
commit_hash.each_value do |repo_hash|
|
243
|
+
repo_hash.each_value do |state_hash|
|
244
|
+
next if state_hash.nil?
|
245
|
+
|
246
|
+
repo_state_hash['revision'] << state_hash['name']
|
247
|
+
repo_state_hash['branch'] << state_hash['branch']
|
248
|
+
repo_state_hash['deploy_organization'] << state_hash['organization']
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
repo_state_hash['revision'] = repo_state_hash['revision'].compact.uniq.first
|
253
|
+
repo_state_hash['branch'] = repo_state_hash['branch'].compact.uniq.first
|
254
|
+
repo_state_hash['deploy_organization'] = repo_state_hash['deploy_organization'].compact.uniq.first
|
255
|
+
|
256
|
+
repo_state_hash
|
257
|
+
end
|
240
258
|
end
|
241
259
|
end
|
@@ -15,8 +15,9 @@ class Cheftacular
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class StatelessAction
|
18
|
-
def pass
|
19
|
-
@options['node_name'] = ARGV[1]
|
18
|
+
def pass node_name=''
|
19
|
+
@options['node_name'] = ARGV[1] if !@options['node_name'] && node_name.blank?
|
20
|
+
@options['node_name'] = node_name if !@options['node_name'] && !node_name.blank?
|
20
21
|
|
21
22
|
nodes = @config['error'].is_valid_node_name_option?
|
22
23
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
class Cheftacular
|
3
|
+
class StatelessActionDocumentation
|
4
|
+
def ssh
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
7
|
+
"`cft ssh NODE_NAME` ssh you into the node name you are trying to access. "+
|
8
|
+
"It will also drop the server's sudo password into your clipboard. "
|
9
|
+
]
|
10
|
+
|
11
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'SSHs you into a node regardless of environment'
|
12
|
+
|
13
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class StatelessAction
|
18
|
+
def ssh
|
19
|
+
@options['node_name'] = ARGV[1] unless @options['node_name']
|
20
|
+
|
21
|
+
@config['stateless_action'].pass(@options['node_name'])
|
22
|
+
|
23
|
+
nodes = @config['error'].is_valid_node_name_option?
|
24
|
+
|
25
|
+
nodes.each do |n|
|
26
|
+
puts("Beginning ssh run for #{ n.name } (#{ n.public_ipaddress })") unless @options['quiet']
|
27
|
+
|
28
|
+
start_ssh_session(n.public_ipaddress)
|
29
|
+
end
|
30
|
+
|
31
|
+
@config['auditor'].notify_slack_on_completion("ssh run completed on #{ @options['node_name'] } (#{ nodes.first.public_ipaddress })\n") if @config['cheftacular']['auditing']
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def start_ssh_session ip_address
|
37
|
+
`ssh #{ Cheftacular::SSH_INLINE_VARS } -t #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } > /dev/tty`
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/cheftacular/version.rb
CHANGED
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.14.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: 2016-03-
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- lib/cheftacular/actions/run.rb
|
263
263
|
- lib/cheftacular/actions/scale.rb
|
264
264
|
- lib/cheftacular/actions/tail.rb
|
265
|
+
- lib/cheftacular/actions/verify.rb
|
265
266
|
- lib/cheftacular/auditor.rb
|
266
267
|
- lib/cheftacular/chef/data_bag.rb
|
267
268
|
- lib/cheftacular/cheftacular.rb
|
@@ -330,6 +331,7 @@ files:
|
|
330
331
|
- lib/cheftacular/stateless_actions/server_update.rb
|
331
332
|
- lib/cheftacular/stateless_actions/service.rb
|
332
333
|
- lib/cheftacular/stateless_actions/slack.rb
|
334
|
+
- lib/cheftacular/stateless_actions/ssh.rb
|
333
335
|
- lib/cheftacular/stateless_actions/test_env.rb
|
334
336
|
- lib/cheftacular/stateless_actions/update_chef_client.rb
|
335
337
|
- lib/cheftacular/stateless_actions/update_cheftacular.rb
|