cheftacular 2.8.0 → 2.9.0
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 +4 -4
- data/lib/cheftacular/README.md +92 -70
- data/lib/cheftacular/actions/check.rb +3 -2
- data/lib/cheftacular/actions/console.rb +8 -2
- data/lib/cheftacular/actions/db_console.rb +28 -4
- data/lib/cheftacular/actions/deploy.rb +6 -8
- data/lib/cheftacular/actions/log.rb +7 -2
- data/lib/cheftacular/actions/migrate.rb +16 -5
- data/lib/cheftacular/actions/run.rb +10 -3
- data/lib/cheftacular/actions/scale.rb +4 -1
- data/lib/cheftacular/actions/tail.rb +8 -3
- data/lib/cheftacular/cheftacular.rb +1 -1
- data/lib/cheftacular/cloud_provider.rb +5 -1
- data/lib/cheftacular/dns.rb +1 -1
- data/lib/cheftacular/error.rb +2 -2
- data/lib/cheftacular/file_system.rb +50 -0
- data/lib/cheftacular/getter.rb +1 -1
- data/lib/cheftacular/helper.rb +34 -5
- data/lib/cheftacular/initializer.rb +15 -25
- data/lib/cheftacular/parser.rb +2 -0
- data/lib/cheftacular/stateless_actions/add_ssh_key_to_bag.rb +4 -1
- data/lib/cheftacular/stateless_actions/arguments.rb +8 -3
- data/lib/cheftacular/stateless_actions/backups.rb +5 -2
- data/lib/cheftacular/stateless_actions/bootstrappers/ubuntu_bootstrap.rb +8 -5
- data/lib/cheftacular/stateless_actions/check_cheftacular_yml_keys.rb +15 -1
- data/lib/cheftacular/stateless_actions/chef_bootstrap.rb +9 -2
- data/lib/cheftacular/stateless_actions/chef_server.rb +5 -2
- data/lib/cheftacular/stateless_actions/cheftacular_config.rb +26 -4
- data/lib/cheftacular/stateless_actions/cheftacular_yml_help.rb +31 -0
- data/lib/cheftacular/stateless_actions/clean_cookbooks.rb +6 -37
- data/lib/cheftacular/stateless_actions/clear_caches.rb +9 -2
- data/lib/cheftacular/stateless_actions/client_list.rb +5 -2
- data/lib/cheftacular/stateless_actions/cloud.rb +4 -1
- data/lib/cheftacular/stateless_actions/cloud_bootstrap.rb +4 -1
- data/lib/cheftacular/stateless_actions/compile_audit_log.rb +4 -1
- data/lib/cheftacular/stateless_actions/compile_readme.rb +10 -1
- data/lib/cheftacular/stateless_actions/create_git_key.rb +4 -1
- data/lib/cheftacular/stateless_actions/disk_report.rb +5 -2
- data/lib/cheftacular/stateless_actions/environment.rb +5 -2
- data/lib/cheftacular/stateless_actions/file.rb +5 -2
- data/lib/cheftacular/stateless_actions/fix_known_hosts.rb +5 -2
- data/lib/cheftacular/stateless_actions/full_bootstrap.rb +10 -2
- data/lib/cheftacular/stateless_actions/get_active_ssh_connections.rb +3 -2
- data/lib/cheftacular/stateless_actions/get_haproxy_log.rb +5 -2
- data/lib/cheftacular/stateless_actions/get_log_from_bag.rb +5 -2
- data/lib/cheftacular/stateless_actions/get_pg_pass.rb +5 -2
- data/lib/cheftacular/stateless_actions/get_shorewall_allowed_connections.rb +2 -1
- data/lib/cheftacular/stateless_actions/help.rb +28 -16
- data/lib/cheftacular/stateless_actions/initialize_cheftacular_yml.rb +4 -1
- data/lib/cheftacular/stateless_actions/initialize_data_bag_contents.rb +4 -1
- data/lib/cheftacular/stateless_actions/knife_upload.rb +4 -1
- data/lib/cheftacular/stateless_actions/list_toggleable_roles.rb +5 -2
- data/lib/cheftacular/stateless_actions/location_aliases.rb +5 -2
- data/lib/cheftacular/stateless_actions/pass.rb +5 -2
- data/lib/cheftacular/stateless_actions/reinitialize.rb +4 -1
- data/lib/cheftacular/stateless_actions/remove_client.rb +9 -2
- data/lib/cheftacular/stateless_actions/replication_status.rb +4 -1
- data/lib/cheftacular/stateless_actions/reset_bag.rb +4 -1
- data/lib/cheftacular/stateless_actions/restart_swap.rb +4 -1
- data/lib/cheftacular/stateless_actions/role_toggle.rb +7 -4
- data/lib/cheftacular/stateless_actions/rvm.rb +4 -1
- data/lib/cheftacular/stateless_actions/server_update.rb +5 -2
- data/lib/cheftacular/stateless_actions/service.rb +4 -1
- data/lib/cheftacular/stateless_actions/slack.rb +4 -1
- data/lib/cheftacular/stateless_actions/test_env.rb +4 -1
- data/lib/cheftacular/stateless_actions/update_chef_client.rb +2 -1
- data/lib/cheftacular/stateless_actions/update_cloudflare_dns_from_cloud.rb +4 -1
- data/lib/cheftacular/stateless_actions/update_split_branches.rb +4 -1
- data/lib/cheftacular/stateless_actions/update_thecheftacularcookbook.rb +38 -0
- data/lib/cheftacular/stateless_actions/update_tld.rb +4 -1
- data/lib/cheftacular/stateless_actions/upload_nodes.rb +6 -3
- data/lib/cheftacular/stateless_actions/upload_roles.rb +4 -1
- data/lib/cheftacular/version.rb +1 -1
- data/lib/cloud_interactor/authentication.rb +3 -4
- data/lib/cloud_interactor/flavor.rb +7 -2
- data/lib/cloud_interactor/helpers.rb +5 -1
- data/lib/cloud_interactor/server/create.rb +7 -2
- data/lib/sshkit/actions/start_task.rb +9 -1
- metadata +6 -7
- data/bin/client-list +0 -4
- data/lib/cheftacular/stateless_actions/clean_sensu_plugins.rb +0 -19
|
@@ -2,20 +2,24 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def cheftacular_config
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft cheftacular_config [display|sync|overwrite]` this command " +
|
|
7
8
|
"Allows you to interact with your complete cheftacular configuration, the union of all repository's cheftacular.ymls. ",
|
|
8
9
|
|
|
9
10
|
[
|
|
10
11
|
" 1. `display` will show the current overall configuration for cheftacular.",
|
|
11
12
|
|
|
12
|
-
" 2. `
|
|
13
|
-
|
|
13
|
+
" 2. `diff` will show the difference between your current cheftacular.yml and the server's. Run automatically on a sync.",
|
|
14
|
+
|
|
15
|
+
" 3. `sync` will sync your local cheftacular yaml keys ONTO the server's keys. Will send a slack notification " +
|
|
14
16
|
"if slack is configured (the slack notification contains the diffed keys). The sync only occurs if there are CHANGES to the file."
|
|
15
17
|
]
|
|
16
18
|
]
|
|
17
19
|
|
|
18
|
-
@config['documentation']['
|
|
20
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Allows you to see the overall cheftacular config or force a sync'
|
|
21
|
+
|
|
22
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
19
23
|
end
|
|
20
24
|
end
|
|
21
25
|
|
|
@@ -34,7 +38,25 @@ class Cheftacular
|
|
|
34
38
|
ap(@config['cheftacular'], {indent: 2})
|
|
35
39
|
end
|
|
36
40
|
|
|
41
|
+
def cheftacular_config_diff
|
|
42
|
+
diff_hash = @config['initial_cheftacular_yml'].deep_diff(@config['default']['cheftacular_bag_hash'], true).except('mode', 'default_repository').compact
|
|
43
|
+
|
|
44
|
+
diff_hash.each_pair do |key, value|
|
|
45
|
+
diff_hash.delete(key) if value.empty? || value.nil?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
if @config['helper'].running_in_mode?('devops') && !diff_hash.empty?
|
|
49
|
+
puts "Difference detected between local cheftacular.yml and data bag cheftacular.yml! Displaying..."
|
|
50
|
+
|
|
51
|
+
ap diff_hash
|
|
52
|
+
elsif @config['helper'].running_in_mode?('application') && @config['default']['cheftacular_bag_hash']['slack']['webhook'] && !diff_hash.empty?
|
|
53
|
+
@config['slack_queue'] << diff_hash.awesome_inspect({plain: true, indent: 2}).prepend('```').insert(-1, '```')
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
37
57
|
def cheftacular_config_sync
|
|
58
|
+
cheftacular_config_diff
|
|
59
|
+
|
|
38
60
|
parsed_cheftacular = Digest::SHA2.hexdigest(@config['helper'].get_cheftacular_yml_as_hash.to_s)
|
|
39
61
|
|
|
40
62
|
return true if File.exist?(@config['filesystem'].local_cheftacular_file_cache_path) && File.read(@config['filesystem'].local_cheftacular_file_cache_path) == parsed_cheftacular
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
class Cheftacular
|
|
3
|
+
class StatelessActionDocumentation
|
|
4
|
+
def cheftacular_yml_help
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
7
|
+
"[NYI]`cft cheftacular_yml_help KEY` this command" +
|
|
8
|
+
"allows you to get help on the meaning of each key in your cheftacular.yml overall config.",
|
|
9
|
+
|
|
10
|
+
[
|
|
11
|
+
" 1. This command can also by run with `cft yaml_help`."
|
|
12
|
+
]
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = '[NYI]Gives help on the keys in your cheftacular.yml'
|
|
16
|
+
|
|
17
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class StatelessAction
|
|
22
|
+
def cheftacular_yml_help command=''
|
|
23
|
+
raise "Not Yet Implemented"
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
alias_method :yaml_help, :cheftacular_yml_help
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def clean_cookbooks
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft clean_cookbooks [force] [remove_cookbooks]` allows you to update the internal chef-repo's cookbooks easily. " +
|
|
7
8
|
"By default this script will force you to decide what to do with each cookbook individually (shows version numbers and whether to overwrite it to cookbooks or not).",
|
|
8
9
|
|
|
@@ -12,6 +13,8 @@ class Cheftacular
|
|
|
12
13
|
" 2. If you would like to remove all the cookbooks on the chef server, run `knife cookbook bulk delete '.*' -p -c ~/.chef/knife.rb`"
|
|
13
14
|
]
|
|
14
15
|
]
|
|
16
|
+
|
|
17
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Allows you to update all cookbooks via berkshelf'
|
|
15
18
|
end
|
|
16
19
|
end
|
|
17
20
|
|
|
@@ -35,43 +38,9 @@ class Cheftacular
|
|
|
35
38
|
out = `berks install`
|
|
36
39
|
puts "#{out}\nFinished... Beginning directory scanning and conflict resolution..."
|
|
37
40
|
|
|
38
|
-
berkshelf_cookbooks =
|
|
39
|
-
|
|
40
|
-
Dir.foreach(@config['locs']['berks']) do |berkshelf_cookbook|
|
|
41
|
-
next if @config['filesystem'].is_junk_filename?(berkshelf_cookbook)
|
|
42
|
-
skip = false
|
|
43
|
-
|
|
44
|
-
berkshelf_cookbooks.keys.each do |processed_berkshelf_cookbook|
|
|
45
|
-
if processed_berkshelf_cookbook.rpartition('-').first == berkshelf_cookbook.rpartition('-').first
|
|
46
|
-
cookbook_mtime = File.mtime(File.expand_path("#{ @config['locs']['berks'] }/#{ berkshelf_cookbook }"))
|
|
47
|
-
pcookbook_mtime = File.mtime(File.expand_path("#{ @config['locs']['berks'] }/#{ processed_berkshelf_cookbook }"))
|
|
48
|
-
|
|
49
|
-
skip = true if cookbook_mtime < pcookbook_mtime #get only the latest version, berkshelf pulls in multiple commits from git repos for SOME REASON
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
next if skip
|
|
54
|
-
|
|
55
|
-
berkshelf_cookbooks[berkshelf_cookbook] = if File.exists?(File.expand_path("#{ @config['locs']['berks'] }/#{ berkshelf_cookbook }/metadata.rb"))
|
|
56
|
-
File.read(File.expand_path("#{ @config['locs']['berks'] }/#{ berkshelf_cookbook }/metadata.rb")).gsub('"',"'").gsub(/^version[\s]*('\d[.\d]+')/).peek[/('\d[.\d]+')/].gsub("'",'')
|
|
57
|
-
else
|
|
58
|
-
berkshelf_cookbook.split('-').last
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
chef_repo_cookbooks = {}
|
|
63
|
-
|
|
64
|
-
Dir.foreach(@config['locs']['cookbooks']) do |chef_repo_cookbook|
|
|
65
|
-
next if @config['filesystem'].is_junk_filename?(chef_repo_cookbook)
|
|
66
|
-
|
|
67
|
-
new_name = chef_repo_cookbook.rpartition('-').first
|
|
41
|
+
berkshelf_cookbooks = @config['filesystem'].parse_latest_berkshelf_cookbook_versions
|
|
68
42
|
|
|
69
|
-
|
|
70
|
-
File.read(File.expand_path("#{ @config['locs']['cookbooks'] }/#{ chef_repo_cookbook }/metadata.rb")).gsub('"',"'").gsub(/^version[\s]*('\d[.\d]+')/).peek[/('\d[.\d]+')/].gsub("'",'')
|
|
71
|
-
else
|
|
72
|
-
JSON.parse(File.read(File.expand_path("#{ @config['locs']['cookbooks'] }/#{ chef_repo_cookbook }/metadata.json"))).to_hash['version']
|
|
73
|
-
end
|
|
74
|
-
end
|
|
43
|
+
chef_repo_cookbooks = @config['filesystem'].parse_chef_repo_cookbook_versions
|
|
75
44
|
|
|
76
45
|
berkshelf_cookbooks.each_pair do |berkshelf_cookbook, version|
|
|
77
46
|
new_name = berkshelf_cookbook.rpartition('-').first
|
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def clear_caches
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft clear_caches` this command allows you to clear all of your local caches.",
|
|
8
|
+
|
|
9
|
+
[
|
|
10
|
+
" 1. This command will force you to refetch all previously cached chef server data on the next `cft` run."
|
|
11
|
+
]
|
|
7
12
|
]
|
|
8
13
|
|
|
9
|
-
@config['documentation']['
|
|
14
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Clears all cheftacular caches'
|
|
15
|
+
|
|
16
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
10
17
|
end
|
|
11
18
|
end
|
|
12
19
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def client_list
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft client_list` Allows you check the basic information for all the servers setup via chef. " +
|
|
7
8
|
"Shows the server's short name, its public ip address and roles (run_list) by default.",
|
|
8
9
|
|
|
@@ -17,7 +18,9 @@ class Cheftacular
|
|
|
17
18
|
]
|
|
18
19
|
]
|
|
19
20
|
|
|
20
|
-
@config['documentation']['
|
|
21
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Retrieves useful information for all servers in all environments'
|
|
22
|
+
|
|
23
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
21
24
|
end
|
|
22
25
|
end
|
|
23
26
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def cloud
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft cloud <FIRST_LEVEL_ARG> [<SECOND_LEVEL_ARG>[:<SECOND_LEVEL_ARG_QUERY>]*] ` this command handles talking to various cloud APIs. " +
|
|
7
8
|
"If no args are passed nothing will happen.",
|
|
8
9
|
|
|
@@ -114,6 +115,8 @@ class Cheftacular
|
|
|
114
115
|
"exists on DigitalOcean under a different name, this specific command will fail with a generic error. Please check your keys."
|
|
115
116
|
]
|
|
116
117
|
]
|
|
118
|
+
|
|
119
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Retrieves useful information about cloud services being used'
|
|
117
120
|
end
|
|
118
121
|
end
|
|
119
122
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def cloud_bootstrap
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft cloud_bootstrap NODE_NAME FLAVOR_NAME [DESCRIPTOR] [--with-dn DOMAIN]` uses a cloud api to " +
|
|
7
8
|
"create a server and attaches its DOMAIN_NAME to the TLD specified for that environment (IE: example-staging.com for staging)",
|
|
8
9
|
|
|
@@ -21,6 +22,8 @@ class Cheftacular
|
|
|
21
22
|
"It is recommended to enter a custom repository-dependent tag here to make nodes easier to load-balance like \"lb:[CODEBASE_NAME]\""
|
|
22
23
|
]
|
|
23
24
|
]
|
|
25
|
+
|
|
26
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Uses the cloud API to setup a server and bring it to a deployable state'
|
|
24
27
|
end
|
|
25
28
|
end
|
|
26
29
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def compile_audit_log
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft compile_audit_log [clean]` compiles the audit logs in each environment's " +
|
|
6
7
|
"audit data bag a audit-log-CURRENTDAY.md file in the log folder of the application. Bear in mind that the bag " +
|
|
7
8
|
"can only hold 100K bytes and will need to have that data removed to store more than that."
|
|
8
9
|
]
|
|
10
|
+
|
|
11
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Compiles the audit logs for all environments'
|
|
9
12
|
end
|
|
10
13
|
end
|
|
11
14
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def compile_readme
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft compile_readme` compiles all documentation methods and creates a README.md file in the log folder of the application."
|
|
6
7
|
]
|
|
8
|
+
|
|
9
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Compiles and creates a readme based on all accessable commands'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class InitializationAction
|
|
14
|
+
def compile_readme
|
|
15
|
+
|
|
7
16
|
end
|
|
8
17
|
end
|
|
9
18
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def create_git_key
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft create_git_key ID_RSA_FILE [OAUTH_TOKEN]` This command will update the default/authentication data bag with new credentials. " +
|
|
6
7
|
"The [ID_RSA_FILE](https://help.github.com/articles/generating-ssh-keys) needs to exist beforehand.",
|
|
7
8
|
|
|
@@ -14,6 +15,8 @@ class Cheftacular
|
|
|
14
15
|
" 3. NOTE! The ID_RSA_FILE should be in your .chef folder in the root of your home directory!"
|
|
15
16
|
]
|
|
16
17
|
]
|
|
18
|
+
|
|
19
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Adds a git key to your authentication bag so your github repos can be accessed'
|
|
17
20
|
end
|
|
18
21
|
end
|
|
19
22
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def disk_report
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft disk_report` will fetch useful statistics from every server for every environment and output it into your log directory."
|
|
6
7
|
]
|
|
7
8
|
|
|
8
|
-
@config['documentation']['application']
|
|
9
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
10
|
+
|
|
11
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Retrives basic info about the filesystem for your nodes'
|
|
9
12
|
end
|
|
10
13
|
end
|
|
11
14
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def environment
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft environment boot|destroy` will boot / destroy the current environment",
|
|
7
8
|
|
|
8
9
|
[
|
|
@@ -15,7 +16,9 @@ class Cheftacular
|
|
|
15
16
|
]
|
|
16
17
|
]
|
|
17
18
|
|
|
18
|
-
@config['documentation']['
|
|
19
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Boots (or destroys) an environment based on data stored in cheftacular.yml'
|
|
20
|
+
|
|
21
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
19
22
|
end
|
|
20
23
|
end
|
|
21
24
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def file
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft file NODE_NAME LOCATION_ALIAS MODE FILE_NAME` interacts with a file on the remote server",
|
|
6
7
|
|
|
7
8
|
[
|
|
@@ -41,7 +42,9 @@ class Cheftacular
|
|
|
41
42
|
]
|
|
42
43
|
]
|
|
43
44
|
|
|
44
|
-
@config['documentation']['
|
|
45
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Allows you to perform a variety of file commands on a remote file'
|
|
46
|
+
|
|
47
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
45
48
|
end
|
|
46
49
|
end
|
|
47
50
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def fix_known_hosts
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft fix_known_hosts [HOSTNAME]` this command will delete entries in your known_hosts file " +
|
|
7
8
|
"for all the servers that are in our system (ip addresses AND dns names)",
|
|
8
9
|
|
|
@@ -11,7 +12,9 @@ class Cheftacular
|
|
|
11
12
|
]
|
|
12
13
|
]
|
|
13
14
|
|
|
14
|
-
@config['documentation']['
|
|
15
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Fixes issues with the known_hosts ssh file'
|
|
16
|
+
|
|
17
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
15
18
|
end
|
|
16
19
|
end
|
|
17
20
|
|
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def full_bootstrap
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft full_bootstrap ADDRESS ROOT_PASS NODE_NAME` This command performs both " +
|
|
7
|
-
"#{ @config['cheftacular']['preferred_cloud_os'] }_bootstrap and chef_bootstrap."
|
|
8
|
+
"#{ @config['cheftacular']['preferred_cloud_os'] }_bootstrap and chef_bootstrap.",
|
|
9
|
+
|
|
10
|
+
[
|
|
11
|
+
" 1. This command is run by `cft cloud_bootstrap` and should not be run on its own unless the " +
|
|
12
|
+
"target server is already created and not initialized."
|
|
13
|
+
]
|
|
8
14
|
]
|
|
15
|
+
|
|
16
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Attempts to setup a server that has already been created'
|
|
9
17
|
end
|
|
10
18
|
end
|
|
11
19
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def get_active_ssh_connections
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"[NYI]`cft get_active_ssh_connections` will fetch the active ssh connections from every server and output it into your log directory."
|
|
6
7
|
]
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
#@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
9
10
|
end
|
|
10
11
|
end
|
|
11
12
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def get_haproxy_log
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft get_haproxy_log` this command will generate a haproxy html file for the load balancer(s) associated with a repository in the log directory. " +
|
|
7
8
|
"Opening this log file in the browser will show the status of that haproxy at the time of the log. ",
|
|
8
9
|
|
|
@@ -11,7 +12,9 @@ class Cheftacular
|
|
|
11
12
|
]
|
|
12
13
|
]
|
|
13
14
|
|
|
14
|
-
@config['documentation']['
|
|
15
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Attempts to fetch haproxy load balancer logs from the remote server(s)'
|
|
16
|
+
|
|
17
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
15
18
|
end
|
|
16
19
|
end
|
|
17
20
|
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def get_log_from_bag
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft get_log_from_bag <NODE_NAME-COMMAND_TYPE>` this command grabs the latest command run log from the data bags " +
|
|
7
8
|
"and saves it to your log directory. There are different types of logs saved per server depending on command."
|
|
8
9
|
]
|
|
9
10
|
|
|
10
|
-
@config['documentation']['
|
|
11
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Fetches all the logs stored in the current environment bags'
|
|
12
|
+
|
|
13
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
11
14
|
end
|
|
12
15
|
end
|
|
13
16
|
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def get_pg_pass
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft get_pg_pass ['clip']` command will output the current environment's pg_password to your terminal. " +
|
|
7
8
|
"Optionally you can pass in clip like `cft get_pg_pass clip` to have it also copy the pass to your clipboard."
|
|
8
9
|
]
|
|
9
10
|
|
|
10
|
-
@config['documentation']['
|
|
11
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = "Fetches the current environment's postgres password"
|
|
12
|
+
|
|
13
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
11
14
|
end
|
|
12
15
|
end
|
|
13
16
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def get_shorewall_allowed_connections
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft get_shorewall_allowed_connections [PATH_TO_LOCAL_FILE] -n NODE_NAME` command will query a single server and return all of its ACCEPT connections " +
|
|
6
7
|
"from shorewall in it's syslog and return the results in a CSV format. Useful for tracking IP activity.",
|
|
7
8
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def help
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft help COMMAND|MODE` this command returns the documentation for a specific command if COMMAND matches the name of a command. " +
|
|
6
7
|
"Alternatively, it can be passed `action|arguments|application|current|devops|stateless_action` to fetch the commands for a specific mode." +
|
|
7
8
|
"Misspellings of commands will display near hits."
|
|
8
9
|
]
|
|
9
10
|
|
|
10
|
-
@config['documentation']['
|
|
11
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Displays useful help related information based on the current context'
|
|
12
|
+
|
|
13
|
+
@config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
|
|
11
14
|
end
|
|
12
15
|
end
|
|
13
16
|
|
|
@@ -27,34 +30,43 @@ class Cheftacular
|
|
|
27
30
|
when 'action' then inference_modes << 'action'
|
|
28
31
|
when 'application' || 'devops' then inference_modes << 'both'
|
|
29
32
|
when 'stateless_action' then inference_modes << 'stateless_action'
|
|
30
|
-
when '' then inference_modes << '
|
|
33
|
+
when '' then inference_modes << 'short_context_descriptions'
|
|
31
34
|
end
|
|
32
35
|
|
|
33
36
|
if @config['helper'].is_command? target_command
|
|
34
37
|
@config['action_documentation'].send(target_command)
|
|
35
38
|
|
|
36
|
-
puts @config['documentation']['action'].flatten.join("\n\n")
|
|
37
|
-
|
|
39
|
+
puts @config['documentation']['action'][target_command.to_sym]['long_description'].flatten.join("\n\n")
|
|
38
40
|
elsif @config['helper'].is_stateless_command? target_command
|
|
39
41
|
@config['stateless_action_documentation'].send(target_command)
|
|
40
42
|
|
|
41
|
-
puts @config['documentation']['stateless_action'].flatten.join("\n\n")
|
|
43
|
+
puts @config['documentation']['stateless_action'][target_command.to_sym]['long_description'].flatten.join("\n\n")
|
|
42
44
|
end
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
@config['action_documentation'].
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
@config['stateless_action_documentation'].public_methods(false).each do |method|
|
|
50
|
-
@config['stateless_action_documentation'].send(method)
|
|
46
|
+
if inference_modes.include?('action') || inference_modes.include?('both') || inference_modes.include?('short_context_descriptions')
|
|
47
|
+
@config['action_documentation'].public_methods(false).each do |method|
|
|
48
|
+
@config['action_documentation'].send(method)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
if inference_modes.include?('action') || inference_modes.include?('both') ||
|
|
53
|
+
( inference_modes.include?('short_context_descriptions') && @config['helper'].running_in_mode?('devops') )
|
|
54
|
+
|
|
55
|
+
@config['stateless_action_documentation'].public_methods(false).each do |method|
|
|
56
|
+
@config['stateless_action_documentation'].send(method)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
53
59
|
|
|
54
60
|
puts @config['documentation']['arguments'].flatten.join("\n\n") if target_command == 'arguments'
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
if inference_modes.include?('short_context_descriptions')
|
|
63
|
+
if @config['helper'].running_in_mode?('devops')
|
|
64
|
+
puts @config['helper'].compile_short_context_descriptions(@config['documentation']['action'].merge(@config['documentation']['stateless_action']), 35)
|
|
65
|
+
else
|
|
66
|
+
puts @config['helper'].compile_short_context_descriptions(@config['documentation']['action'].merge(@config['documentation']['application']))
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
58
70
|
puts @config['helper'].compile_documentation_lines(target_command).flatten.join("\n\n") if target_command =~ /action|stateless_action|application|devops/
|
|
59
71
|
|
|
60
72
|
if inference_modes.empty? && @config['helper'].is_not_command_or_stateless_command?(target_command)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def initialize_cheftacular_yml
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft initialize_cheftacular_yml [application|TheCheftacularCookbook]` will create a cheftacular.yml " +
|
|
6
7
|
"file in your config folder (and create the config folder if it does not exist). If you already have a cheftacular.yml file " +
|
|
7
8
|
"in the config folder, it will create a cheftacular.example.yml file that will contain the new changes / keys in the latest " +
|
|
@@ -13,6 +14,8 @@ class Cheftacular
|
|
|
13
14
|
" 2. If `application` is passed, the generated cheftacular.yml file will look like one you could use in an application directory."
|
|
14
15
|
]
|
|
15
16
|
]
|
|
17
|
+
|
|
18
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Sets up a cheftacular.yml file or a cheftacular.yml.example file'
|
|
16
19
|
end
|
|
17
20
|
end
|
|
18
21
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
class Cheftacular
|
|
2
2
|
class StatelessActionDocumentation
|
|
3
3
|
def initialize_data_bag_contents
|
|
4
|
-
@config['documentation']['stateless_action']
|
|
4
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
5
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
5
6
|
"`cft initialize_data_bag_contents ENVIRONMENT_NAME` will ensure the data bags always have the correct structure before each run. " +
|
|
6
7
|
"This command is run every time the gem is started and if called directly, will exit after completion."
|
|
7
8
|
]
|
|
9
|
+
|
|
10
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Ensures the data bags always contain correct initialization information'
|
|
8
11
|
end
|
|
9
12
|
end
|
|
10
13
|
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
class Cheftacular
|
|
3
3
|
class StatelessActionDocumentation
|
|
4
4
|
def knife_upload
|
|
5
|
-
@config['documentation']['stateless_action']
|
|
5
|
+
@config['documentation']['stateless_action'][__method__] ||= {}
|
|
6
|
+
@config['documentation']['stateless_action'][__method__]['long_description'] = [
|
|
6
7
|
"`cft knife_upload` will resync the chef-server with the local chef-repo code. " +
|
|
7
8
|
"This command is analog for `knife upload /`"
|
|
8
9
|
]
|
|
10
|
+
|
|
11
|
+
@config['documentation']['stateless_action'][__method__]['short_description'] = 'Uploads your current cookbooks to the chef server'
|
|
9
12
|
end
|
|
10
13
|
end
|
|
11
14
|
|