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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cheftacular/README.md +92 -70
  3. data/lib/cheftacular/actions/check.rb +3 -2
  4. data/lib/cheftacular/actions/console.rb +8 -2
  5. data/lib/cheftacular/actions/db_console.rb +28 -4
  6. data/lib/cheftacular/actions/deploy.rb +6 -8
  7. data/lib/cheftacular/actions/log.rb +7 -2
  8. data/lib/cheftacular/actions/migrate.rb +16 -5
  9. data/lib/cheftacular/actions/run.rb +10 -3
  10. data/lib/cheftacular/actions/scale.rb +4 -1
  11. data/lib/cheftacular/actions/tail.rb +8 -3
  12. data/lib/cheftacular/cheftacular.rb +1 -1
  13. data/lib/cheftacular/cloud_provider.rb +5 -1
  14. data/lib/cheftacular/dns.rb +1 -1
  15. data/lib/cheftacular/error.rb +2 -2
  16. data/lib/cheftacular/file_system.rb +50 -0
  17. data/lib/cheftacular/getter.rb +1 -1
  18. data/lib/cheftacular/helper.rb +34 -5
  19. data/lib/cheftacular/initializer.rb +15 -25
  20. data/lib/cheftacular/parser.rb +2 -0
  21. data/lib/cheftacular/stateless_actions/add_ssh_key_to_bag.rb +4 -1
  22. data/lib/cheftacular/stateless_actions/arguments.rb +8 -3
  23. data/lib/cheftacular/stateless_actions/backups.rb +5 -2
  24. data/lib/cheftacular/stateless_actions/bootstrappers/ubuntu_bootstrap.rb +8 -5
  25. data/lib/cheftacular/stateless_actions/check_cheftacular_yml_keys.rb +15 -1
  26. data/lib/cheftacular/stateless_actions/chef_bootstrap.rb +9 -2
  27. data/lib/cheftacular/stateless_actions/chef_server.rb +5 -2
  28. data/lib/cheftacular/stateless_actions/cheftacular_config.rb +26 -4
  29. data/lib/cheftacular/stateless_actions/cheftacular_yml_help.rb +31 -0
  30. data/lib/cheftacular/stateless_actions/clean_cookbooks.rb +6 -37
  31. data/lib/cheftacular/stateless_actions/clear_caches.rb +9 -2
  32. data/lib/cheftacular/stateless_actions/client_list.rb +5 -2
  33. data/lib/cheftacular/stateless_actions/cloud.rb +4 -1
  34. data/lib/cheftacular/stateless_actions/cloud_bootstrap.rb +4 -1
  35. data/lib/cheftacular/stateless_actions/compile_audit_log.rb +4 -1
  36. data/lib/cheftacular/stateless_actions/compile_readme.rb +10 -1
  37. data/lib/cheftacular/stateless_actions/create_git_key.rb +4 -1
  38. data/lib/cheftacular/stateless_actions/disk_report.rb +5 -2
  39. data/lib/cheftacular/stateless_actions/environment.rb +5 -2
  40. data/lib/cheftacular/stateless_actions/file.rb +5 -2
  41. data/lib/cheftacular/stateless_actions/fix_known_hosts.rb +5 -2
  42. data/lib/cheftacular/stateless_actions/full_bootstrap.rb +10 -2
  43. data/lib/cheftacular/stateless_actions/get_active_ssh_connections.rb +3 -2
  44. data/lib/cheftacular/stateless_actions/get_haproxy_log.rb +5 -2
  45. data/lib/cheftacular/stateless_actions/get_log_from_bag.rb +5 -2
  46. data/lib/cheftacular/stateless_actions/get_pg_pass.rb +5 -2
  47. data/lib/cheftacular/stateless_actions/get_shorewall_allowed_connections.rb +2 -1
  48. data/lib/cheftacular/stateless_actions/help.rb +28 -16
  49. data/lib/cheftacular/stateless_actions/initialize_cheftacular_yml.rb +4 -1
  50. data/lib/cheftacular/stateless_actions/initialize_data_bag_contents.rb +4 -1
  51. data/lib/cheftacular/stateless_actions/knife_upload.rb +4 -1
  52. data/lib/cheftacular/stateless_actions/list_toggleable_roles.rb +5 -2
  53. data/lib/cheftacular/stateless_actions/location_aliases.rb +5 -2
  54. data/lib/cheftacular/stateless_actions/pass.rb +5 -2
  55. data/lib/cheftacular/stateless_actions/reinitialize.rb +4 -1
  56. data/lib/cheftacular/stateless_actions/remove_client.rb +9 -2
  57. data/lib/cheftacular/stateless_actions/replication_status.rb +4 -1
  58. data/lib/cheftacular/stateless_actions/reset_bag.rb +4 -1
  59. data/lib/cheftacular/stateless_actions/restart_swap.rb +4 -1
  60. data/lib/cheftacular/stateless_actions/role_toggle.rb +7 -4
  61. data/lib/cheftacular/stateless_actions/rvm.rb +4 -1
  62. data/lib/cheftacular/stateless_actions/server_update.rb +5 -2
  63. data/lib/cheftacular/stateless_actions/service.rb +4 -1
  64. data/lib/cheftacular/stateless_actions/slack.rb +4 -1
  65. data/lib/cheftacular/stateless_actions/test_env.rb +4 -1
  66. data/lib/cheftacular/stateless_actions/update_chef_client.rb +2 -1
  67. data/lib/cheftacular/stateless_actions/update_cloudflare_dns_from_cloud.rb +4 -1
  68. data/lib/cheftacular/stateless_actions/update_split_branches.rb +4 -1
  69. data/lib/cheftacular/stateless_actions/update_thecheftacularcookbook.rb +38 -0
  70. data/lib/cheftacular/stateless_actions/update_tld.rb +4 -1
  71. data/lib/cheftacular/stateless_actions/upload_nodes.rb +6 -3
  72. data/lib/cheftacular/stateless_actions/upload_roles.rb +4 -1
  73. data/lib/cheftacular/version.rb +1 -1
  74. data/lib/cloud_interactor/authentication.rb +3 -4
  75. data/lib/cloud_interactor/flavor.rb +7 -2
  76. data/lib/cloud_interactor/helpers.rb +5 -1
  77. data/lib/cloud_interactor/server/create.rb +7 -2
  78. data/lib/sshkit/actions/start_task.rb +9 -1
  79. metadata +6 -7
  80. data/bin/client-list +0 -4
  81. data/lib/cheftacular/stateless_actions/clean_sensu_plugins.rb +0 -19
@@ -2,11 +2,14 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def list_toggleable_roles
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft list_toggleable_roles NODE_NAME` This command will allow you to see all toggleable roles for a node"
7
8
  ]
8
9
 
9
- @config['documentation']['application'] << @config['documentation']['stateless_action'].last
10
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Lists toggleable roles for a node'
11
+
12
+ @config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
10
13
  end
11
14
  end
12
15
 
@@ -1,12 +1,15 @@
1
1
  class Cheftacular
2
2
  class StatelessActionDocumentation
3
3
  def location_aliases
4
- @config['documentation']['stateless_action'] << [
4
+ @config['documentation']['stateless_action'][__method__] ||= {}
5
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
5
6
  "`cft location_aliases` will list all location aliases listed in your cheftacular.yml. These aliases can be used " +
6
7
  "in the `cft file` command."
7
8
  ]
8
9
 
9
- @config['documentation']['application'] << @config['documentation']['stateless_action'].last
10
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Checks your location aliases that can be used with the cft file command'
11
+
12
+ @config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
10
13
  end
11
14
  end
12
15
 
@@ -2,12 +2,15 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def pass
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft pass NODE_NAME` will drop the server's sudo password into your clipboard. " +
7
8
  "Useful for when you need to ssh into the server itself and try advanced linux commands"
8
9
  ]
9
10
 
10
- @config['documentation']['application'] << @config['documentation']['stateless_action'].last
11
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Retrieves the password for a node regardless of environment'
12
+
13
+ @config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
11
14
  end
12
15
  end
13
16
 
@@ -2,10 +2,13 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def reinitialize
5
- @config['documentation']['action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft reinitialize IP_ADDRESS NODE_NAME` will reconnect a server previously managed by chef to a new chef server. " +
7
8
  "The node name MUST MATCH THE NODE'S ORIGINAL NODE NAME for the roles to be setup correctly."
8
9
  ]
10
+
11
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Attempts to connect a node to a new chef server'
9
12
  end
10
13
  end
11
14
 
@@ -2,16 +2,21 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def remove_client
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft remove_client NODE_NAME [destroy]` removes a client (and its node data) from the chef-server. " +
7
8
  "It also removes its dns records from the cloud service (if possible). " +
8
9
  "This should not be done lightly as you will have to wipe the server and trigger another chef-client " +
9
10
  "run to get it to register again. Alternatively, you can run `cft reinitialize IP_ADDRESS NODE_NAME as well.",
10
11
 
11
12
  [
12
- " 1. `destroy` deletes the server as well as removing it from the chef environment."
13
+ " 1. `destroy` deletes the server as well as removing it from the chef environment.",
14
+
15
+ " 2. This command is aliased to `cft remove_node`"
13
16
  ]
14
17
  ]
18
+
19
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Removes a node from the chef server'
15
20
  end
16
21
  end
17
22
 
@@ -67,5 +72,7 @@ class Cheftacular
67
72
 
68
73
  puts(`client-list`) if @options['verbose']
69
74
  end
75
+
76
+ alias_method :remove_node, :remove_client
70
77
  end
71
78
  end
@@ -2,10 +2,13 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def replication_status
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft replication_status` will check the status of the database master and slaves in every environment. " +
7
8
  "Also lists how far behind the slaves are from the master in milliseconds."
8
9
  ]
10
+
11
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Checks the replication status for the current environment (postgres only)'
9
12
  end
10
13
  end
11
14
 
@@ -2,10 +2,13 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def reset_bag
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft reset_bag BAG_NAME` this command allows you to reset a data bag item to an empty state. " +
7
8
  "Run this on full data bags to clear them out. "
8
9
  ]
10
+
11
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Resets certain data bags to their initial state'
9
12
  end
10
13
  end
11
14
 
@@ -1,7 +1,8 @@
1
1
  class Cheftacular
2
2
  class StatelessActionDocumentation
3
3
  def restart_swap
4
- @config['documentation']['stateless_action'] << [
4
+ @config['documentation']['stateless_action'][__method__] ||= {}
5
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
5
6
  "`cft restart_swap` will restart the swap on every server that doesn't have swap currently on. " +
6
7
  "Useful if you notice servers with no swap activated from `cft disk_report`",
7
8
 
@@ -10,6 +11,8 @@ class Cheftacular
10
11
  "the server was rebooted and this command fixes that."
11
12
  ]
12
13
  ]
14
+
15
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Restarts the swap on all servers'
13
16
  end
14
17
  end
15
18
 
@@ -6,7 +6,8 @@ class Cheftacular
6
6
  @config['cheftacular']['role_toggling'] ||= {}
7
7
  @config['cheftacular']['role_toggling']['deactivated_role_suffix'] ||= '_deactivate'
8
8
 
9
- @config['documentation']['stateless_action'] << [
9
+ @config['documentation']['stateless_action'][__method__] ||= {}
10
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
10
11
  "`cft role_toggle NODE_NAME ROLE_NAME activate|deactivate` This command will allow you to **toggle** roles on nodes without using `cft upload_nodes`",
11
12
 
12
13
  [
@@ -28,7 +29,9 @@ class Cheftacular
28
29
  ]
29
30
  ]
30
31
 
31
- @config['documentation']['application'] << @config['documentation']['stateless_action'].last
32
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Attempts to toggle the specified role on the specified node'
33
+
34
+ @config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
32
35
  end
33
36
  end
34
37
 
@@ -45,7 +48,7 @@ class Cheftacular
45
48
 
46
49
  @config['initializer'].initialize_node_roles_bag_contents @options['env']
47
50
 
48
- @config['filesystem'].cleanup_file_caches('current')
51
+ @config['filesystem'].cleanup_file_caches('current-nodes')
49
52
 
50
53
  nodes = @config['error'].is_valid_node_name_option?
51
54
 
@@ -134,7 +137,7 @@ class Cheftacular
134
137
 
135
138
  @config['ChefDataBag'].save_node_roles_bag @options['env']
136
139
 
137
- @config['filesystem'].cleanup_file_caches('current')
140
+ @config['filesystem'].cleanup_file_caches('current-nodes')
138
141
 
139
142
  puts "Triggering deploy to set the new role..."
140
143
 
@@ -2,7 +2,8 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def rvm
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft rvm [COMMAND] [ADDITIONAL_COMMANDS]*` will run rvm commands on the remote servers. " +
7
8
  "Output from this command for each server will go into your rvm directory under the log directory. " +
8
9
  "Please refer to [the rvm help page](https://rvm.io/rvm) for more information on rvm commands.",
@@ -31,6 +32,8 @@ class Cheftacular
31
32
  "It will also check and attempt to upgrade pre 1.25 installations of RVM to 1.26+ (which requires a GPG key)."
32
33
  ]
33
34
  ]
35
+
36
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Useful wrapper command for various rvm commands'
34
37
  end
35
38
  end
36
39
 
@@ -2,15 +2,18 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def server_update
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft server_update [restart]` allows you to force update all nodes' packages for a specific environment. " +
7
8
  "This should be done with caution as this *might* break something.",
8
9
 
9
10
  [
10
- " 1. `cft apt_update restart` will prompt to ask if you also want to restart all servers in a rolling restart. " +
11
+ " 1. `cft server_update restart` will prompt to ask if you also want to restart all servers in a rolling restart. " +
11
12
  "This should be done with extreme caution and only in a worst-case scenario."
12
13
  ]
13
14
  ]
15
+
16
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Attempts to update all servers for an env to their latest packages'
14
17
  end
15
18
  end
16
19
 
@@ -2,7 +2,8 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def service
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft service [COMMAND] [SERVICE]` will run service commands on remote servers. " +
7
8
  "This command only runs on the first server it comes across. Specify others with -n NODE_NAME.",
8
9
 
@@ -15,6 +16,8 @@ class Cheftacular
15
16
  "service if it has a .conf file on the remote server in the /etc/init directory."
16
17
  ]
17
18
  ]
19
+
20
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Allows you to interact with a service running on a server'
18
21
  end
19
22
  end
20
23
 
@@ -1,7 +1,8 @@
1
1
  class Cheftacular
2
2
  class StatelessActionDocumentation
3
3
  def slack
4
- @config['documentation']['stateless_action'] << [
4
+ @config['documentation']['stateless_action'][__method__] ||= {}
5
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
5
6
  "`cft slack \"MESSAGE\" [CHANNEL]` will attempt to post the message to the webhook set in your cheftacular.yml. " +
6
7
  "Slack posts to your default channel by default but if the CHANNEL argument is supplied the message will post there.",
7
8
 
@@ -12,6 +13,8 @@ class Cheftacular
12
13
  " 2. Remember, if you have auditing turned on in your cheftacular.yml, you can track who sends what to slack."
13
14
  ]
14
15
  ]
16
+
17
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Sends slack messages'
15
18
  end
16
19
  end
17
20
 
@@ -2,7 +2,8 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def test_env
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft test_env [TARGET_ENV] boot|destroy` will create (or destroy) the test nodes for a particular environment " +
7
8
  "(defaults to staging, prod split-envs can be set with `-p`). Please read below for how TARGET_ENV works",
8
9
 
@@ -17,6 +18,8 @@ class Cheftacular
17
18
  "This is set in the environment's config data bag under the tld key"
18
19
  ]
19
20
  ]
21
+
22
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Allows you to boot split environments'
20
23
  end
21
24
  end
22
25
 
@@ -2,7 +2,8 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def update_chef_client
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "[NYI]`cft update_chef_client` attempts to update the chef-client of all nodes to the latest version. " +
7
8
  "Should be done with caution and with the chef_server's version in mind."
8
9
  ]
@@ -1,7 +1,8 @@
1
1
  class Cheftacular
2
2
  class StatelessActionDocumentation
3
3
  def update_cloudflare_dns_from_cloud
4
- @config['documentation']['stateless_action'] << [
4
+ @config['documentation']['stateless_action'][__method__] ||= {}
5
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
5
6
  "`cft update_cloudflare_dns_from_cloud [skip_update_tld]` command will force a full dns update for cloudflare. ",
6
7
 
7
8
  [
@@ -16,6 +17,8 @@ class Cheftacular
16
17
  "_before_ cloudflare is updated. Only skip if you believe your domain info on your cloud is accurate."
17
18
  ]
18
19
  ]
20
+
21
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Forces a refresh / update of all relevant cloudflare records'
19
22
  end
20
23
  end
21
24
 
@@ -2,7 +2,8 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def update_split_branches
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft update_split_branches` will perform a series of git commands that will merge all the " +
7
8
  "split branches for your split_branch enabled repositories with what is currently on master and push them.",
8
9
 
@@ -18,6 +19,8 @@ class Cheftacular
18
19
  "with changes to your current working directory. You must commit these changes before running this command."
19
20
  ]
20
21
  ]
22
+
23
+ @config['documentation']['stateless_action'][__method__]['short_description'] = '(Local) attempts to reset and push all your split branches in your target repo'
21
24
  end
22
25
  end
23
26
 
@@ -0,0 +1,38 @@
1
+
2
+ class Cheftacular
3
+ class StatelessActionDocumentation
4
+ def update_thecheftacularcookbook
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
7
+ "`cft update_thecheftacularcookbook` allows you to update ONLY the internal chef-repo's TheCheftacularCookbook."
8
+ ]
9
+
10
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Useful for ONLY updating TheCheftacularCookbook'
11
+ end
12
+ end
13
+
14
+ class StatelessAction
15
+ def update_thecheftacularcookbook local_options={'interactive' => true}
16
+ raise "This action can only be performed if the mode is set to devops" unless @config['helper'].running_in_mode?('devops')
17
+
18
+ @config['cheftacular']['wrapper_cookbooks'].split(',').each do |wrapper_cookbook|
19
+ wrapper_cookbook_loc = "#{ @config['locs']['cookbooks'] }/#{ wrapper_cookbook }"
20
+ FileUtils.rm_rf(File.expand_path("#{ @config['locs']['berks'] }/cookbooks")) if File.exists?(File.expand_path("#{ @config['locs']['berks'] }/cookbooks"))
21
+
22
+ Dir.chdir wrapper_cookbook_loc
23
+ puts "Installing new cookbooks..."
24
+ out = `berks install`
25
+ puts "#{out}\nFinished fetching cookbooks, moving TheCheftacularCookbook into local chef repo"
26
+
27
+ cheftacular_cookbook = @config['filesystem'].parse_latest_berkshelf_cookbook_versions.select {|key| key.include?('TheCheftacularCookbook')}['TheCheftacularCookbook']
28
+
29
+ puts "Moving TheCheftacularCookbook (#{ cheftacular_cookbook['version'] })[#{ cheftacular_cookbook['mtime'] }] to your chef-repo!"
30
+
31
+ `rm -Rf #{ @config['locs']['cookbooks'] }/TheCheftacularCookbook` if File.exists?(File.expand_path("#{ @config['locs']['cookbooks'] }/TheCheftacularCookbook"))
32
+ `cp -Rf #{ @config['locs']['berks'] }/#{ cheftacular_cookbook['location'] } #{ @config['locs']['cookbooks'] }/TheCheftacularCookbook`
33
+
34
+ break
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,12 +1,15 @@
1
1
  class Cheftacular
2
2
  class StatelessActionDocumentation
3
3
  def update_tld
4
- @config['documentation']['stateless_action'] << [
4
+ @config['documentation']['stateless_action'][__method__] ||= {}
5
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
5
6
  "`cft update_tld TLD` command will force a full dns update for a tld in the preferred cloud. " +
6
7
  "It will ensure all the subdomain entries are correct (based on the contents of the addresses data bag) " +
7
8
  "and update them if they are not. It will also create the local subdomain for the entry as well if it " +
8
9
  "does exist and point it to the correct private address."
9
10
  ]
11
+
12
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Forces a full refresh of your specified dns provider'
10
13
  end
11
14
  end
12
15
 
@@ -2,7 +2,8 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def upload_nodes
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft upload_nodes` This command will resync the chef server's nodes with the data in our chef-repo/node_roles. ",
7
8
 
8
9
  [
@@ -20,12 +21,14 @@ class Cheftacular
20
21
  " 1. Due to this, only users running this against their chef-repo need to worry about having a nodes_dir, the way it should be."
21
22
  ]
22
23
  ]
24
+
25
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Updates all nodes based on info in your nodes_dir'
23
26
  end
24
27
  end
25
28
 
26
29
  class StatelessAction
27
30
  def upload_nodes invalidate_file_node_cache=false
28
- @config['filesystem'].cleanup_file_caches('current') if invalidate_file_node_cache
31
+ @config['filesystem'].cleanup_file_caches('current-nodes') if invalidate_file_node_cache
29
32
 
30
33
  raise "This action can only be performed if the mode is set to devops" if !@config['helper'].running_in_mode?('devops') && !@options['in_scaling']
31
34
 
@@ -128,7 +131,7 @@ class Cheftacular
128
131
  @config['ChefDataBag'].save_node_roles_bag env
129
132
  end if !@options['force_yes'] && @config['helper'].running_in_mode?('devops')
130
133
 
131
- @config['filesystem'].cleanup_file_caches('current') if invalidate_file_node_cache
134
+ @config['filesystem'].cleanup_file_caches('current-nodes') if invalidate_file_node_cache
132
135
  end
133
136
  end
134
137
  end
@@ -2,9 +2,12 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def upload_roles
5
- @config['documentation']['stateless_action'] << [
5
+ @config['documentation']['stateless_action'][__method__] ||= {}
6
+ @config['documentation']['stateless_action'][__method__]['long_description'] = [
6
7
  "`cft upload_roles` This command will resync the chef server's roles with the data in the chef-repo/roles."
7
8
  ]
9
+
10
+ @config['documentation']['stateless_action'][__method__]['short_description'] = 'Updates all roles based on data in your roles dir'
8
11
  end
9
12
  end
10
13
 
@@ -1,5 +1,5 @@
1
1
  class Cheftacular
2
2
  #major_version.minor_version.bugfixes
3
- VERSION = "2.8.0"
3
+ VERSION = "2.9.0"
4
4
  RUBY_VERSION = "2.2.2"
5
5
  end
@@ -63,10 +63,9 @@ class CloudInteractor
63
63
  }
64
64
  when 'digitalocean'
65
65
  {
66
- provider: 'DigitalOcean',
67
- digitalocean_api_key: @auth_hash['cloud_authentication'][@options['preferred_cloud']]['api_key'],
68
- digitalocean_client_id: @auth_hash['cloud_authentication'][@options['preferred_cloud']]['client_id']
69
- #version: :v1
66
+ provider: 'DigitalOcean',
67
+ digitalocean_token: @auth_hash['cloud_authentication'][@options['preferred_cloud']]['api_key'],
68
+ version: :v2
70
69
  }
71
70
  else raise "CloudInteractor Does not currently support #{ @options['preferred_cloud'] } at this time"
72
71
  end
@@ -18,10 +18,15 @@ class CloudInteractor
18
18
  @classes['helper'].generic_list_call IDENTITY, RESOURCE, output
19
19
  end
20
20
 
21
- def read args, output=true
21
+ def read args, output=true, mode='name'
22
22
  list [], false
23
23
 
24
- @classes['helper'].generic_read_parse args, IDENTITY, output
24
+ if @options['preferred_cloud'] =~ /digitalocean/
25
+ mode = 'slug'
26
+ args['slug'] = args['name'] if args.class == Hash
27
+ end
28
+
29
+ @classes['helper'].generic_read_parse args, IDENTITY, output, mode
25
30
  end
26
31
  end
27
32
  end
@@ -62,7 +62,11 @@ class CloudInteractor
62
62
 
63
63
  specific_fog_object = @classes['auth'].auth_service(resource).instance_eval(identity).get @main_obj["specific_#{ identity }"].last['id']
64
64
 
65
- @main_obj["#{ identity }_destroy_request"] = specific_fog_object.destroy
65
+ if specific_fog_object.respond_to?(:delete)
66
+ @main_obj["#{ identity }_destroy_request"] = specific_fog_object.delete
67
+ else
68
+ @main_obj["#{ identity }_destroy_request"] = specific_fog_object.destroy
69
+ end
66
70
 
67
71
  puts "REMINDER! This destroy is not instant! It can take up to a few minutes for a #{ identity.singularize } to actually be fully destroyed!"
68
72
  end
@@ -27,9 +27,14 @@ class CloudInteractor
27
27
  }
28
28
 
29
29
  if @options['preferred_cloud'] == 'digitalocean'
30
- final_create_args[:region_id] = @main_obj['specific_regions'].first['id']
31
- final_create_args[:ssh_key_ids] = @main_obj['specific_ssh_keys'].first['id']
30
+ final_create_args[:region] = @main_obj['specific_regions'].first['slug']
31
+ final_create_args[:ssh_keys] = [@main_obj['specific_ssh_keys'].first['id']]
32
+ final_create_args[:size] = @main_obj['specific_flavors'].first['slug']
33
+ final_create_args[:image] = @main_obj['specific_images'].first['slug']
32
34
  final_create_args[:private_networking] = true
35
+
36
+ final_create_args.delete(:flavor_id)
37
+ final_create_args.delete(:image_id)
33
38
  end
34
39
 
35
40
  @main_obj["#{ IDENTITY }_create_request"] = JSON.parse(@classes['auth'].auth_service(RESOURCE).instance_eval(IDENTITY).create(final_create_args).to_json)
@@ -30,7 +30,15 @@ module SSHKit
30
30
  puts("Nothing to migrate for #{ options['role'] }...")
31
31
  end
32
32
 
33
- [out, timestamp] #return out to send to logs_bag
33
+ [out, timestamp, 0] #return out to send to logs_bag
34
+ rescue SSHKit::Command::Failed => e
35
+ puts "@@@@@CRITICAL! #{ command } failed for #{ name } (#{ ip_address })! Please check your #{ log_loc }/failed-deploy for the logs!@@@@@"
36
+
37
+ puts(e.message)
38
+
39
+ ::File.open("#{ log_loc }/failed-deploy/#{ name }-task-#{ timestamp }.txt", "w") { |f| f.write(e.message.scrub_pretty_text) }
40
+
41
+ [e.message, timestamp, 1]
34
42
  end
35
43
  end
36
44
  end
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.8.0
4
+ version: 2.9.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-10-03 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: '1.35'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: '1.35'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: slack-notifier
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -212,7 +212,6 @@ email:
212
212
  - louis@socialcentiv.com
213
213
  - loualrid@gmail.com
214
214
  executables:
215
- - client-list
216
215
  - cft
217
216
  - cheftacular
218
217
  - cftclr
@@ -222,7 +221,6 @@ files:
222
221
  - bin/cft
223
222
  - bin/cftclr
224
223
  - bin/cheftacular
225
- - bin/client-list
226
224
  - lib/cheftacular.rb
227
225
  - lib/cheftacular/README.md
228
226
  - lib/cheftacular/action.rb
@@ -265,8 +263,8 @@ files:
265
263
  - lib/cheftacular/stateless_actions/chef_bootstrap.rb
266
264
  - lib/cheftacular/stateless_actions/chef_server.rb
267
265
  - lib/cheftacular/stateless_actions/cheftacular_config.rb
266
+ - lib/cheftacular/stateless_actions/cheftacular_yml_help.rb
268
267
  - lib/cheftacular/stateless_actions/clean_cookbooks.rb
269
- - lib/cheftacular/stateless_actions/clean_sensu_plugins.rb
270
268
  - lib/cheftacular/stateless_actions/clean_server_passwords.rb
271
269
  - lib/cheftacular/stateless_actions/cleanup_log_files.rb
272
270
  - lib/cheftacular/stateless_actions/clear_caches.rb
@@ -307,6 +305,7 @@ files:
307
305
  - lib/cheftacular/stateless_actions/update_chef_client.rb
308
306
  - lib/cheftacular/stateless_actions/update_cloudflare_dns_from_cloud.rb
309
307
  - lib/cheftacular/stateless_actions/update_split_branches.rb
308
+ - lib/cheftacular/stateless_actions/update_thecheftacularcookbook.rb
310
309
  - lib/cheftacular/stateless_actions/update_tld.rb
311
310
  - lib/cheftacular/stateless_actions/upload_nodes.rb
312
311
  - lib/cheftacular/stateless_actions/upload_roles.rb
data/bin/client-list DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'cheftacular/cheftacular'
3
-
4
- Cheftacular.new('command'=>'client_list')
@@ -1,19 +0,0 @@
1
- class Cheftacular
2
- class StatelessActionDocumentation
3
- def clean_sensu_plugins
4
- @config['documentation']['stateless_action'] << [
5
- "[NYI]`cft clean_sensu_plugins` will checkout / update the sensu community plugins github repo on your " +
6
- "local machine and sync any sensu plugin files in your wrapper cookbook directory with what is in the repo."
7
- ]
8
- end
9
- end
10
-
11
- class StatelessAction
12
- def clean_sensu_plugins
13
- raise "This method is not yet implemented"
14
- raise "This action can only be performed if the mode is set to devops" unless @config['helper'].running_in_mode?('devops')
15
-
16
- #TODO use this to keep the cookbook files directory up to date with the sensu community plugins repo
17
- end
18
- end
19
- end