cheftacular 2.13.1 → 2.13.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92f2e70957d1d62c5599891b291c67693b3577de
4
- data.tar.gz: c02911fd60f6acb0b49bc9ad3011a22caf57d90c
3
+ metadata.gz: 1a426853edae71510b1d45b85e5ec0458cc1cb84
4
+ data.tar.gz: 12482be7a61f011eb367a4da241c34f5897ebc87
5
5
  SHA512:
6
- metadata.gz: 3153b70f011016ee0f051a9d423eab7042b2501e088e959701cf09600ab78c9a025b82474017b1a2d3505e19c63941fe202d40d0315881666362847edea0212d
7
- data.tar.gz: ec88f2eaac833915e014a53fdd665d5748ab5ddb9da1228fce851889f91e8b38b01119af5afabecf79490d314d870096f1bd0d91a0567b412d0e0a17ed874fa1
6
+ metadata.gz: 5e4a01ad45c27f56ca5a80b34705e1a844c8a9edcc6f83df8bfed791087aa52e93b41acbd00678652e3f3c8e32cbdc73fa2304d5772b01021d5674bed5006cff
7
+ data.tar.gz: 1a94cb22a4b198c3f16763ca3ca13c6ecd55d33453f5470866f728a8960aa254548f99838c79e2810a23adae1dada6e2de6c7f74a00ab6d145a2657582d78fa6
@@ -82,6 +82,10 @@
82
82
 
83
83
  5. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server.
84
84
 
85
+ 6. `status` will display the current state of the backups
86
+
87
+ 6. By default, the backups command will use the context of your current environment to trigger backup related commands.
88
+
85
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.
86
90
 
87
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).
@@ -286,6 +290,8 @@
286
290
 
287
291
  4. IMPORTANT NOTE: You cannot run `cft run rake -T` as is, you have to enclose any command that uses command line dash arguments in quotes like `cft run "rake -T"`
288
292
 
293
+ 5. Can also be used to run meteor commands and is aliased to `cft meteor`
294
+
289
295
  28. `cft scale up|down [NUM_TO_SCALE]` will add (or remove) NUM_TO_SCALE servers from the server array. This command will not let you scale down below 1 server.
290
296
 
291
297
  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.
@@ -313,25 +319,13 @@
313
319
 
314
320
  1. `SPECIFIC_REPOSITORY` is a special argument, if left blank the key will be placed in the authorized_keys array in the bag, otherwise it will be placed in the specific_authorized_keys hash under a key named for the repository that is passed. The script will error if SPECIFIC_REPOSITORY does not exist in the cheftacular.yml respositories hash. You can then use this data to give users selective ssh access to certain servers.
315
321
 
316
- 3. `cft backups [activate|deactivate|fetch|load|restore]` this command sets the fetch_backups and restore_backups flags in your config data bag for an environment. These can be used to give application developers a way to trigger / untrigger restores in an environment
317
-
318
- 1. `activate` will turn on automated backup running (turns on the flag for the env in the config bag).
319
-
320
- 2. `deactivate` will turn off automated backup running.
321
-
322
- 3. `fetch` will fetch the latest backup and drop it onto your machine. This argument accepts the --save-to-file LOCATION flag.
323
-
324
- 4. `load` will fetch the latest backup from the production primary **if it doesn't already exist on the server** and run the _backup loading command_ to load this backup into the env.
325
-
326
- 5. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server.
327
-
328
- 4. `cft check_cheftacular_yml_keys` allows you to check to see if your cheftacular yml keys are valid to the current version of cheftacular. It will also set your missing keys to their likely default and let you know to update the cheftacular.yml file.
322
+ 3. `cft check_cheftacular_yml_keys` allows you to check to see if your cheftacular yml keys are valid to the current version of cheftacular. It will also set your missing keys to their likely default and let you know to update the cheftacular.yml file.
329
323
 
330
- 5. `cft chef_bootstrap_from_queue` allows you to register a node in the chef system, remove any lingering data that may be associated with it and update the node's runlist if it has an entry in nodes_dir for its NODE_NAME.
324
+ 4. `cft chef_bootstrap_from_queue` allows you to register a node in the chef system, remove any lingering data that may be associated with it and update the node's runlist if it has an entry in nodes_dir for its NODE_NAME.
331
325
 
332
326
  1. This command is part of the `cft full_bootstrap` command and cannot be called directly
333
327
 
334
- 6. `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.
328
+ 5. `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.
335
329
 
336
330
  1. `restart` restarts all chef processes on the chef server which may alleviate slow cheftacular load times for some users. (NOTE) do not run this command while the chef-server is performing actions or instability may result! Not tested for high volume chef servers.
337
331
 
@@ -343,7 +337,7 @@
343
337
 
344
338
  5. NOTE 2! Cheftacular does not (and will not) support accessing your chef server over ssh with password auth. If you have done this, you should feel bad and immediately switch ssh access to key authentication...
345
339
 
346
- 7. `cft cheftacular_config [diff|display|sync|overwrite]` this command Allows you to interact with your complete cheftacular configuration, the union of all repository's cheftacular.ymls.
340
+ 6. `cft cheftacular_config [diff|display|sync|overwrite]` this command Allows you to interact with your complete cheftacular configuration, the union of all repository's cheftacular.ymls.
347
341
 
348
342
  1. `display` will show the current overall configuration for cheftacular.
349
343
 
@@ -353,29 +347,29 @@
353
347
 
354
348
  4. This command is aliased to `cc`
355
349
 
356
- 8. `cft cheftacular_yml_help KEY` this commandallows you to get help on the meaning of each key in your cheftacular.yml overall config.
350
+ 7. `cft cheftacular_yml_help KEY` this commandallows you to get help on the meaning of each key in your cheftacular.yml overall config.
357
351
 
358
352
  1. This command can also by run with `cft yaml_help`.
359
353
 
360
354
  2. To examine nested keys, you can use colons inbetween the keys like cloud_authentication:rackspace:email
361
355
 
362
- 9. `cft clean_cookbooks [force] [remove_cookbooks]` allows you to update the internal chef-repo's cookbooks easily. 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).
356
+ 8. `cft clean_cookbooks [force] [remove_cookbooks]` allows you to update the internal chef-repo's cookbooks easily. 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).
363
357
 
364
358
  1. `force` argument will cause the downloaded cookbooks to *always* overwrite the chef-repo's cookbooks as long as the downloaded cookbook has a higher version number.
365
359
 
366
360
  2. If you would like to remove all the cookbooks on the chef server, run `knife cookbook bulk delete '.*' -p -c ~/.chef/knife.rb`
367
361
 
368
- 10. `cft cleanup_logs [DIRECTORIES_TO_NOT_DELETE]` this command allows you to clear your local log files
362
+ 9. `cft cleanup_logs [DIRECTORIES_TO_NOT_DELETE]` this command allows you to clear your local log files
369
363
 
370
364
  1. By default, this command will delete all the cheftacular directories in your log folder.
371
365
 
372
366
  2. This command supports a comma separated list of folders you don't want to delete.
373
367
 
374
- 11. `cft clear_caches` this command allows you to clear all of your local caches.
368
+ 10. `cft clear_caches` this command allows you to clear all of your local caches.
375
369
 
376
370
  1. This command will force you to refetch all previously cached chef server data on the next `cft` run.
377
371
 
378
- 12. `cft client_list` Allows you check the basic information for all the servers setup via chef. Shows the server's short name, its public ip address and roles (run_list) by default.
372
+ 11. `cft client_list` Allows you check the basic information for all the servers setup via chef. Shows the server's short name, its public ip address and roles (run_list) by default.
379
373
 
380
374
  1. `-v` option will make this command display the server's domain name, whether its password is stored on the chef server and what that password is.
381
375
 
@@ -389,7 +383,7 @@
389
383
 
390
384
  6. This command is aliased to `cft clients` and `cft cl`
391
385
 
392
- 13. `cft cloud <FIRST_LEVEL_ARG> [<SECOND_LEVEL_ARG>[:<SECOND_LEVEL_ARG_QUERY>]*] ` this command handles talking to various cloud APIs. If no args are passed nothing will happen.
386
+ 12. `cft cloud <FIRST_LEVEL_ARG> [<SECOND_LEVEL_ARG>[:<SECOND_LEVEL_ARG_QUERY>]*] ` this command handles talking to various cloud APIs. If no args are passed nothing will happen.
393
387
 
394
388
  1. `domain` first level argument for interacting with cloud domains
395
389
 
@@ -485,7 +479,7 @@
485
479
 
486
480
  5. `bootstrap` captures the current computer's hostname and checks to see if a key matching this hostname exists on the cloud service. If the key does not exist, the command attempts to read the contents of the ~/.ssh/id_rsa.pub file and create a new key with that data and the hostname of the current computer. Run automatically when creating DigitalOcean servers. It's worth noting that if the computer's key already exists on DigitalOcean under a different name, this specific command will fail with a generic error. Please check your keys.
487
481
 
488
- 14. `cft cloud_bootstrap NODE_NAME FLAVOR_NAME [DESCRIPTOR] [--with-dn DOMAIN]` uses a cloud api to create a server and attaches its DOMAIN_NAME to the TLD specified for that environment (IE: example-staging.com for staging)
482
+ 13. `cft cloud_bootstrap NODE_NAME FLAVOR_NAME [DESCRIPTOR] [--with-dn DOMAIN]` uses a cloud api to create a server and attaches its DOMAIN_NAME to the TLD specified for that environment (IE: example-staging.com for staging)
489
483
 
490
484
  1. If no DOMAIN_NAME is supplied it will use the node's NODE_NAME (IE: api01.example-staging.com)
491
485
 
@@ -497,15 +491,15 @@
497
491
 
498
492
  5. Aliased to `cft cb`
499
493
 
500
- 15. `cft cloud_bootstrap_from_queue` uses a cloud api to create several servers. It is a wrapper around the cloud_bootstrap command that tries to queue server creation.
494
+ 14. `cft cloud_bootstrap_from_queue` uses a cloud api to create several servers. It is a wrapper around the cloud_bootstrap command that tries to queue server creation.
501
495
 
502
496
  1. This command cannot be called directly and can only be utilized from `cft environment boot`
503
497
 
504
- 16. `cft compile_audit_log [clean]` compiles the audit logs in each environment's audit data bag a audit-log-CURRENTDAY.md file in the log folder of the application. Bear in mind that the bag can only hold 100K bytes and will need to have that data removed to store more than that.
498
+ 15. `cft compile_audit_log [clean]` compiles the audit logs in each environment's audit data bag a audit-log-CURRENTDAY.md file in the log folder of the application. Bear in mind that the bag can only hold 100K bytes and will need to have that data removed to store more than that.
505
499
 
506
- 17. `cft compile_readme` compiles all documentation methods and creates a README.md file in the log folder of the application.
500
+ 16. `cft compile_readme` compiles all documentation methods and creates a README.md file in the log folder of the application.
507
501
 
508
- 18. `cft create_git_key ID_RSA_FILE [OAUTH_TOKEN]` This command will update the default/authentication data bag with new credentials. The [ID_RSA_FILE](https://help.github.com/articles/generating-ssh-keys) needs to exist beforehand.
502
+ 17. `cft create_git_key ID_RSA_FILE [OAUTH_TOKEN]` This command will update the default/authentication data bag with new credentials. The [ID_RSA_FILE](https://help.github.com/articles/generating-ssh-keys) needs to exist beforehand.
509
503
 
510
504
  1. This command will upload both the private and public key to the data bag. The public key should be the one that matches the github user for your deployment github user.
511
505
 
@@ -513,9 +507,9 @@
513
507
 
514
508
  3. NOTE! The ID_RSA_FILE should be in your .chef folder in the root of your home directory!
515
509
 
516
- 19. `cft disk_report` will fetch useful statistics from every server for every environment and output it into your log directory.
510
+ 18. `cft disk_report` will fetch useful statistics from every server for every environment and output it into your log directory.
517
511
 
518
- 20. `cft environment boot|boot_without_deploy|destroy|destroy_raw_servers [SERVER_NAMES]` will boot / destroy the current environment
512
+ 19. `cft environment boot|boot_without_deploy|destroy|destroy_raw_servers [SERVER_NAMES]` will boot / destroy the current environment
519
513
 
520
514
  1. `boot` will spin up servers and bring them to a stable state. This includes setting up their subdomains for the target environment.
521
515
 
@@ -531,7 +525,7 @@
531
525
 
532
526
  7. Aliased to `cft e`
533
527
 
534
- 21. `cft file NODE_NAME LOCATION_ALIAS MODE FILE_NAME` interacts with a file on the remote server
528
+ 20. `cft file NODE_NAME LOCATION_ALIAS MODE FILE_NAME` interacts with a file on the remote server
535
529
 
536
530
  1. `LOCATION_ALIAS` will be parsed as a path if it has backslash characters. Otherwise it will be parsed from your location_aliases hash in your cheftacular.yml
537
531
 
@@ -561,39 +555,39 @@
561
555
 
562
556
  1. `--save-to-file FILE_PATH` can also be used in the `fetch` context to specify where exactly to save the file and what to name it as.
563
557
 
564
- 22. `cft fix_known_hosts [HOSTNAME]` this command will delete entries in your known_hosts file for all the servers that are in our system (ip addresses AND dns names)
558
+ 21. `cft fix_known_hosts [HOSTNAME]` this command will delete entries in your known_hosts file for all the servers that are in our system (ip addresses AND dns names)
565
559
 
566
560
  1. Passing in a hostname will make the command only remove entries with that hostname / ip specifically
567
561
 
568
562
  2. Aliased to `cft fkh`
569
563
 
570
- 23. `cft full_bootstrap_from_queue` This command performs both ubuntu_bootstrap and chef_bootstrap.
564
+ 22. `cft full_bootstrap_from_queue` This command performs both ubuntu_bootstrap and chef_bootstrap.
571
565
 
572
566
  1. This command is run by `cft cloud_bootstrap` and should not be run on its own.
573
567
 
574
- 24. `cft get_active_ssh_connections` will fetch the active ssh connections from every server and output it into your log directory.
568
+ 23. `cft get_active_ssh_connections` will fetch the active ssh connections from every server and output it into your log directory.
575
569
 
576
570
  1. This command runs on all servers in an environment by default
577
571
 
578
- 25. `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. Opening this log file in the browser will show the status of that haproxy at the time of the log.
572
+ 24. `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. Opening this log file in the browser will show the status of that haproxy at the time of the log.
579
573
 
580
574
  1. In devops mode, this command will not do anything without the -R repository passed.
581
575
 
582
- 26. `cft get_log_from_bag <NODE_NAME-COMMAND_TYPE>` this command grabs the latest command run log from the data bags and saves it to your log directory. There are different types of logs saved per server depending on command.
576
+ 25. `cft get_log_from_bag <NODE_NAME-COMMAND_TYPE>` this command grabs the latest command run log from the data bags and saves it to your log directory. There are different types of logs saved per server depending on command.
583
577
 
584
- 27. `cft get_pg_pass ['clip']` command will output the current environment's pg_password to your terminal. Optionally you can pass in clip like `cft get_pg_pass clip` to have it also copy the pass to your clipboard.
578
+ 26. `cft get_pg_pass ['clip']` command will output the current environment's pg_password to your terminal. Optionally you can pass in clip like `cft get_pg_pass clip` to have it also copy the pass to your clipboard.
585
579
 
586
- 28. `cft help COMMAND|MODE` this command returns the documentation for a specific command if COMMAND matches the name of a command. Alternatively, it can be passed `action|arguments|application|current|devops|stateless_action` to fetch the commands for a specific mode.Misspellings of commands will display near hits.
580
+ 27. `cft help COMMAND|MODE` this command returns the documentation for a specific command if COMMAND matches the name of a command. Alternatively, it can be passed `action|arguments|application|current|devops|stateless_action` to fetch the commands for a specific mode.Misspellings of commands will display near hits.
587
581
 
588
- 29. `cft initialize_cheftacular_yml [application|TheCheftacularCookbook]` will create a cheftacular.yml file in your config folder (and create the config folder if it does not exist). If you already have a cheftacular.yml file in the config folder, it will create a cheftacular.example.yml file that will contain the new changes / keys in the latest cheftacular version.
582
+ 28. `cft initialize_cheftacular_yml [application|TheCheftacularCookbook]` will create a cheftacular.yml file in your config folder (and create the config folder if it does not exist). If you already have a cheftacular.yml file in the config folder, it will create a cheftacular.example.yml file that will contain the new changes / keys in the latest cheftacular version.
589
583
 
590
584
  1. If `TheCheftacularCookbook` is passed, the generated cheftacular.yml file will include the additional TheCheftacularCookbook keys.
591
585
 
592
586
  2. If `application` is passed, the generated cheftacular.yml file will look like one you could use in an application directory.
593
587
 
594
- 30. `cft initialize_data_bag_contents ENVIRONMENT_NAME` will ensure the data bags always have the correct structure before each run. This command is run every time the gem is started and if called directly, will exit after completion.
588
+ 29. `cft initialize_data_bag_contents ENVIRONMENT_NAME` will ensure the data bags always have the correct structure before each run. This command is run every time the gem is started and if called directly, will exit after completion.
595
589
 
596
- 31. `cft knife_upload [force]` will resync the chef-server with the local chef-repo code. This command is analog for `knife upload /`
590
+ 30. `cft knife_upload [force]` will resync the chef-server with the local chef-repo code. This command is analog for `knife upload /`
597
591
 
598
592
  1. The force option will add the force option to knife upload.
599
593
 
@@ -601,31 +595,31 @@
601
595
 
602
596
  3. Aliased to `cft ku`
603
597
 
604
- 32. `cft list_toggleable_roles NODE_NAME` This command will allow you to see all toggleable roles for a node
598
+ 31. `cft list_toggleable_roles NODE_NAME` This command will allow you to see all toggleable roles for a node
605
599
 
606
- 33. `cft location_aliases` will list all location aliases listed in your cheftacular.yml. These aliases can be used in the `cft file` command.
600
+ 32. `cft location_aliases` will list all location aliases listed in your cheftacular.yml. These aliases can be used in the `cft file` command.
607
601
 
608
602
  1. This command is aliased to `cft la`
609
603
 
610
- 34. `cft pass NODE_NAME` will drop the server's sudo password into your clipboard. Useful for when you need to ssh into the server itself and try advanced linux commands
604
+ 33. `cft pass NODE_NAME` will drop the server's sudo password into your clipboard. Useful for when you need to ssh into the server itself and try advanced linux commands
611
605
 
612
- 35. `cft reinitialize IP_ADDRESS NODE_NAME` will reconnect a server previously managed by chef to a new chef server. The node name MUST MATCH THE NODE'S ORIGINAL NODE NAME for the roles to be setup correctly.
606
+ 34. `cft reinitialize IP_ADDRESS NODE_NAME` will reconnect a server previously managed by chef to a new chef server. The node name MUST MATCH THE NODE'S ORIGINAL NODE NAME for the roles to be setup correctly.
613
607
 
614
- 36. `cft remove_client NODE_NAME [destroy]` removes a client (and its node data) from the chef-server. It also removes its dns records from the cloud service (if possible). This should not be done lightly as you will have to wipe the server and trigger another chef-client run to get it to register again. Alternatively, you can run `cft reinitialize IP_ADDRESS NODE_NAME as well.
608
+ 35. `cft remove_client NODE_NAME [destroy]` removes a client (and its node data) from the chef-server. It also removes its dns records from the cloud service (if possible). This should not be done lightly as you will have to wipe the server and trigger another chef-client run to get it to register again. Alternatively, you can run `cft reinitialize IP_ADDRESS NODE_NAME as well.
615
609
 
616
610
  1. `destroy` deletes the server as well as removing it from the chef environment.
617
611
 
618
612
  2. This command is aliased to `cft remove_node` and `cft rc`
619
613
 
620
- 37. `cft replication_status` will check the status of the database master and slaves in every environment. Also lists how far behind the slaves are from the master in milliseconds.
614
+ 36. `cft replication_status` will check the status of the database master and slaves in every environment. Also lists how far behind the slaves are from the master in milliseconds.
621
615
 
622
- 38. `cft reset_bag BAG_NAME` this command allows you to reset a data bag item to an empty state. Run this on full data bags to clear them out.
616
+ 37. `cft reset_bag BAG_NAME` this command allows you to reset a data bag item to an empty state. Run this on full data bags to clear them out.
623
617
 
624
- 39. `cft restart_swap` will restart the swap on every server that doesn't have swap currently on. Useful if you notice servers with no swap activated from `cft disk_report`
618
+ 38. `cft restart_swap` will restart the swap on every server that doesn't have swap currently on. Useful if you notice servers with no swap activated from `cft disk_report`
625
619
 
626
620
  1. There is no risk in running this command. Sometimes swap doesnt reactivate if the server was rebooted and this command fixes that.
627
621
 
628
- 40. `cft role_toggle NODE_NAME ROLE_NAME activate|deactivate` This command will allow you to **toggle** roles on nodes without using `cft upload_nodes`
622
+ 39. `cft role_toggle NODE_NAME ROLE_NAME activate|deactivate` This command will allow you to **toggle** roles on nodes without using `cft upload_nodes`
629
623
 
630
624
  1. This command uses your *role_toggling:deactivated_role_suffix* attribute set in your cheftacular.yml to toggle the role, it checks to see if the toggled name exists then sets the node's run_list to include the toggled role
631
625
 
@@ -639,7 +633,7 @@
639
633
 
640
634
  4. Aliased to `cft rt`
641
635
 
642
- 41. `cft rvm [COMMAND] [ADDITIONAL_COMMANDS]*` will run rvm commands on the remote servers. Output from this command for each server will go into your rvm directory under the log directory. Please refer to [the rvm help page](https://rvm.io/rvm) for more information on rvm commands.
636
+ 40. `cft rvm [COMMAND] [ADDITIONAL_COMMANDS]*` will run rvm commands on the remote servers. Output from this command for each server will go into your rvm directory under the log directory. Please refer to [the rvm help page](https://rvm.io/rvm) for more information on rvm commands.
643
637
 
644
638
  1. When no commands are passed, rvm will just run `rvm list` on each server on all servers in the current environment.
645
639
 
@@ -655,11 +649,11 @@
655
649
 
656
650
  7. `upgrade_rvm` will run `rvm get stable --auth-dotfiles` on all servers for the current environment. It will also check and attempt to upgrade pre 1.25 installations of RVM to 1.26+ (which requires a GPG key).
657
651
 
658
- 42. `cft server_update [restart]` allows you to force update all nodes' packages for a specific environment. This should be done with caution as this *might* break something.
652
+ 41. `cft server_update [restart]` allows you to force update all nodes' packages for a specific environment. This should be done with caution as this *might* break something.
659
653
 
660
654
  1. `cft server_update restart` will prompt to ask if you also want to restart all servers in a rolling restart. This should be done with extreme caution and only in a worst-case scenario.
661
655
 
662
- 43. `cft service [COMMAND] [SERVICE]` will run service commands on remote servers. This command only runs on the first server it comes across. Specify others with -n NODE_NAME.
656
+ 42. `cft service [COMMAND] [SERVICE]` will run service commands on remote servers. This command only runs on the first server it comes across. Specify others with -n NODE_NAME.
663
657
 
664
658
  1. When no commands are passed, the command will list all the services in the /etc/init directory
665
659
 
@@ -667,13 +661,13 @@
667
661
 
668
662
  3. When `restart|stop|start SERVICE` is passed, the command will attempt to restart|stop|start the service if it has a .conf file on the remote server in the /etc/init directory.
669
663
 
670
- 44. `cft slack "MESSAGE" [CHANNEL]` will attempt to post the message to the webhook set in your cheftacular.yml. Slack posts to your default channel by default but if the CHANNEL argument is supplied the message will post there.
664
+ 43. `cft slack "MESSAGE" [CHANNEL]` will attempt to post the message to the webhook set in your cheftacular.yml. Slack posts to your default channel by default but if the CHANNEL argument is supplied the message will post there.
671
665
 
672
666
  1. NOTE: To prevent confusing spam from many possible sources, the username posted to slack will always be *Cheftacular*. This can be overloaded in the StatelessAction method "slack" but this is not recommended.
673
667
 
674
668
  2. Remember, if you have auditing turned on in your cheftacular.yml, you can track who sends what to slack.
675
669
 
676
- 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
670
+ 44. `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
677
671
 
678
672
  1. TARGET_ENV changes functionality depending on the overall (like staging / production) environment
679
673
 
@@ -683,11 +677,11 @@
683
677
 
684
678
  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
685
679
 
686
- 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.
680
+ 45. `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.
687
681
 
688
- 47. `cft update_cheftacular` this command attempts to update cheftacular to the latest version.
682
+ 46. `cft update_cheftacular` this command attempts to update cheftacular to the latest version.
689
683
 
690
- 48. `cft update_cloudflare_dns_from_cloud [skip_update_tld]` command will force a full dns update for cloudflare.
684
+ 47. `cft update_cloudflare_dns_from_cloud [skip_update_tld]` command will force a full dns update for cloudflare.
691
685
 
692
686
  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.
693
687
 
@@ -695,13 +689,13 @@
695
689
 
696
690
  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.
697
691
 
698
- 49. `cft update_cookbook [COOKBOOK_NAME] [INSTALL_VERSION]` allows you to specifically update a single cookbook
692
+ 48. `cft update_cookbook [COOKBOOK_NAME] [INSTALL_VERSION]` allows you to specifically update a single cookbook
699
693
 
700
694
  1. This command passed with no arguments will update TheCheftacularCookbook
701
695
 
702
696
  2. Aliased to `cft uc`
703
697
 
704
- 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.
698
+ 49. `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.
705
699
 
706
700
  1. Repository must be set with `-R REPOSITORY_NAME` for this command to work.
707
701
 
@@ -711,9 +705,9 @@
711
705
 
712
706
  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.
713
707
 
714
- 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.
708
+ 50. `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.
715
709
 
716
- 52. `cft upload_nodes` This command will resync the chef server's nodes with the data in our chef-repo/node_roles.
710
+ 51. `cft upload_nodes` This command will resync the chef server's nodes with the data in our chef-repo/node_roles.
717
711
 
718
712
  1. This command changes behavior depending on several factors about both your mode and the state of your environment
719
713
 
@@ -727,10 +721,10 @@
727
721
 
728
722
  4. Aliased to `cft un`
729
723
 
730
- 53. `cft upload_roles` This command will resync the chef server's roles with the data in the chef-repo/roles.
724
+ 52. `cft upload_roles` This command will resync the chef server's roles with the data in the chef-repo/roles.
731
725
 
732
726
  1. Aliased to `cft ur`
733
727
 
734
- 54. `cft version` this command prints out the current version of cheftacular.
728
+ 53. `cft version` this command prints out the current version of cheftacular.
735
729
 
736
730
  1. Aliased to `cft v`
@@ -2,8 +2,8 @@
2
2
  class Cheftacular
3
3
  class StatelessActionDocumentation
4
4
  def backups
5
- @config['documentation']['stateless_action'][__method__] ||= {}
6
- @config['documentation']['stateless_action'][__method__]['long_description'] = [
5
+ @config['documentation']['action'][__method__] ||= {}
6
+ @config['documentation']['action'][__method__]['long_description'] = [
7
7
  "`cft backups [activate|deactivate|fetch|load|restore]` this command " +
8
8
  "sets the fetch_backups and restore_backups flags in your config data bag for an environment. " +
9
9
  "These can be used to give application developers a way to trigger / untrigger restores in an environment",
@@ -18,13 +18,15 @@ class Cheftacular
18
18
  " 4. `load` will fetch the latest backup from the production primary **if it doesn't already exist on " +
19
19
  "the server** and run the _backup loading command_ to load this backup into the env.",
20
20
 
21
- " 5. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server."
21
+ " 5. `restore` will simply just run the _backup loading command_ to load the latest backup onto the server.",
22
+
23
+ " 6. `status` will display the current state of the backups",
24
+
25
+ " 6. By default, the backups command will use the context of your current environment to trigger backup related commands."
22
26
  ]
23
27
  ]
24
28
 
25
- @config['documentation']['stateless_action'][__method__]['short_description'] = 'Runs various backup commands on your current environment'
26
-
27
- @config['documentation']['application'][__method__] = @config['documentation']['stateless_action'][__method__]
29
+ @config['documentation']['action'][__method__]['short_description'] = 'Runs various backup commands on your current environment'
28
30
  end
29
31
  end
30
32
 
@@ -32,7 +34,7 @@ class Cheftacular
32
34
  def backups command=''
33
35
  command = ARGV[1] if command.blank?
34
36
 
35
- raise "Unsupported command (#{ command }) for cft backups" unless command =~ /activate|deactivate|fetch|load|restore/
37
+ raise "Unsupported command (#{ command }) for cft backups" unless command =~ /activate|deactivate|fetch|load|restore|status/
36
38
 
37
39
  self.send("backups_#{ command }")
38
40
  end
@@ -66,9 +68,15 @@ class Cheftacular
66
68
  end
67
69
 
68
70
  def backups_restore
71
+ backup_mode = case @config['getter'].get_current_database
72
+ when 'postgresql' then 'pg'
73
+ when 'mongodb' then 'mongo'
74
+ end
75
+
69
76
  target_db_primary, nodes = @config['getter'].get_db_primary_node_and_nodes
70
- applications_as_string = @config['getter'].get_repo_names_for_repositories.keys.join(',')
71
- env_pg_pass = @config[@options['env']]['chef_passwords_bag_hash']['pg_pass']
77
+ applications_as_string = @config['getter'].get_repo_names_for_repositories({ database: @config['getter'].get_current_database }).keys.join(',')
78
+ env_db_pass = @config[@options['env']]['chef_passwords_bag_hash']["#{ backup_mode }_pass"]
79
+ env_db_mode = @config['getter'].get_current_database
72
80
 
73
81
  options, locs, ridley, logs_bag_hash, pass_bag_hash, bundle_command, cheftacular, passwords = @config['helper'].set_local_instance_vars
74
82
 
@@ -79,7 +87,7 @@ class Cheftacular
79
87
 
80
88
  puts("Beginning db_backup_run for #{ n.name } (#{ n.public_ipaddress }) for env #{ options['env'] }") unless options['quiet']
81
89
 
82
- start_db_backup_restore( n.name, n.public_ipaddress, options, locs, cheftacular, passwords, applications_as_string, env_pg_pass, ruby_command )
90
+ start_db_backup_restore( n.name, n.public_ipaddress, options, locs, cheftacular, passwords, applications_as_string, env_db_pass, ruby_command, env_db_mode )
83
91
  end
84
92
  end
85
93
 
@@ -92,14 +100,12 @@ class Cheftacular
92
100
  file_scp_execute(target_db_primary, 'scp', full_backup_dir, status_hash['latest_backup']['filename'])
93
101
  end
94
102
 
95
- private
103
+ def backups_status
104
+ backups_check_current_status
105
+ end
96
106
 
97
107
  def backups_toggle_setting restore_backup, fetch_backup
98
- initial_fetch_backup = @config[@options['env']]['config_bag_hash'][@options['sub_env']]['fetch_backups']
99
- initial_restore_backup = @config[@options['env']]['config_bag_hash'][@options['sub_env']]['restore_backups']
100
-
101
- puts "For #{ @options['env'] } (sub-env: #{ @options['sub_env'] }) fetch backups was set to " +
102
- "#{ initial_fetch_backup ? 'on' : 'off' } and restoring backups was set to #{ initial_restore_backup ? 'on' : 'off' }"
108
+ backups_check_current_status
103
109
 
104
110
  puts "For #{ @options['env'] } (sub-env: #{ @options['sub_env'] }) fetch backups is now set to " +
105
111
  "#{ fetch_backup ? 'on' : 'off' } and restoring backups is now set to #{ restore_backup ? 'on' : 'off' }"
@@ -116,6 +122,14 @@ class Cheftacular
116
122
  @config['action'].deploy
117
123
  end
118
124
 
125
+ def backups_check_current_status
126
+ initial_fetch_backup = @config[@options['env']]['config_bag_hash'][@options['sub_env']]['fetch_backups']
127
+ initial_restore_backup = @config[@options['env']]['config_bag_hash'][@options['sub_env']]['restore_backups']
128
+
129
+ puts "For #{ @options['env'] } (sub-env: #{ @options['sub_env'] }) fetch backups is currently set to " +
130
+ "#{ initial_fetch_backup ? 'on' : 'off' } and restoring backups is currently set to #{ initial_restore_backup ? 'on' : 'off' }"
131
+ end
132
+
119
133
  def backups_get_status_hash_from_backupmaster mode='backups_load', status_hash={}
120
134
  backup_env = @config['cheftacular']['backup_config']['global_backup_environ']
121
135
 
@@ -221,7 +235,7 @@ module SSHKit
221
235
  puts "Finished transferring #{ full_backup_path } to #{ name }(#{ ip_address })..."
222
236
  end
223
237
 
224
- def start_db_backup_restore name, ip_address, options, locs, cheftacular, passwords, applications_as_string, env_pg_pass, ruby_command, out=''
238
+ def start_db_backup_restore name, ip_address, options, locs, cheftacular, passwords, applications_as_string, env_db_pass, ruby_command, env_db_mode, out=''
225
239
  log_loc, timestamp = set_log_loc_and_timestamp(locs)
226
240
 
227
241
  puts "Beginning backup run on #{ name } (#{ ip_address }), this command may take a while to complete..."
@@ -229,8 +243,8 @@ module SSHKit
229
243
  case cheftacular['backup_filesystem']
230
244
  when 'backup_gem'
231
245
  command = cheftacular['backup_config']['backup_load_command']
232
- command = command.gsub('ENVIRONMENT', options['env']).gsub('APPLICATIONS', applications_as_string).gsub('PG_PASS', env_pg_pass)
233
- command = command.gsub('RUBY_COMMAND', ruby_command )
246
+ command = command.gsub('ENVIRONMENT', options['env']).gsub('APPLICATIONS', applications_as_string).gsub('DB_PASS', env_db_pass)
247
+ command = command.gsub('RUBY_COMMAND', ruby_command ).gsub('MODE', env_db_mode)
234
248
 
235
249
  out << sudo_capture( passwords[ip_address], command )
236
250
  when 'raw'
@@ -60,7 +60,7 @@ class Cheftacular
60
60
  true_env = @config['dummy_sshkit'].get_true_environment run_list, @config['cheftacular']['run_list_environments'][@options['env']], @options['env']
61
61
 
62
62
  #the >/dev/tty after the ssh block redirects the full output to stdout, not /dev/null where it normally goes
63
- `ssh -oStrictHostKeyChecking=no -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "cd #{ app_loc } && RAILS_ENV=#{ true_env } #{ @config['bundle_command'] } exec rails c" > /dev/tty`
63
+ `ssh #{ Cheftacular::SSH_INLINE_VARS } -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "cd #{ app_loc } && RAILS_ENV=#{ true_env } #{ @config['bundle_command'] } exec rails c" > /dev/tty`
64
64
  end
65
65
 
66
66
  def start_console_nodejs
@@ -16,7 +16,9 @@ class Cheftacular
16
16
  "It prepends bundle exec to your command for rails stack repositories",
17
17
 
18
18
  " 4. IMPORTANT NOTE: You cannot run `cft run rake -T` as is, you have to enclose any command that uses command line dash " +
19
- 'arguments in quotes like `cft run "rake -T"`'
19
+ 'arguments in quotes like `cft run "rake -T"`',
20
+
21
+ " 5. Can also be used to run meteor commands and is aliased to `cft meteor`"
20
22
  ]
21
23
  ]
22
24
 
@@ -34,33 +36,15 @@ class Cheftacular
34
36
  end
35
37
 
36
38
  def run_ruby_on_rails command
37
- nodes = @config['getter'].get_true_node_objects
38
-
39
- #must have rails stack to run migrations and not be a db, only want ONE node
40
- nodes = @config['parser'].exclude_nodes( nodes, [{ unless: "role[#{ @options['role'] }]" }], !@options['run_on_all'] )
41
-
42
- nodes = @config['parser'].exclude_nodes( nodes, [{ if: "role[#{ @options['negative_role'] }]" }]) if @options['negative_role']
43
-
44
- #this must always precede on () calls so they have the instance variables they need
45
- options, locs, ridley, logs_bag_hash, pass_bag_hash, bundle_command, cheftacular, passwords = @config['helper'].set_local_instance_vars
46
-
47
- on ( nodes.map { |n| @config['cheftacular']['deploy_user'] + "@" + n.public_ipaddress } ) do |host|
48
- n = get_node_from_address(nodes, host.hostname)
49
-
50
- puts("Beginning task run for #{ n.name } (#{ n.public_ipaddress }) on role #{ options['role'] }") unless options['quiet']
51
-
52
- log_data, timestamp, exit_status = start_task( n.name, n.public_ipaddress, n.run_list, "#{ bundle_command } exec #{ command }", options, locs, cheftacular, passwords)
53
-
54
- logs_bag_hash["#{ n.name }-#{ __method__ }"] = { "text" => log_data.scrub_pretty_text, "timestamp" => timestamp, "exit_status" => exit_status }
55
- end
56
-
57
- @config['ChefDataBag'].save_logs_bag
58
-
59
- @config['helper'].send_log_bag_hash_slack_notification(logs_bag_hash, __method__, 'Failing command detected, exiting...')
39
+ run_command(command, __method__.to_s, "#{ @config['bundle_command'] } exec")
60
40
  end
61
41
 
62
42
  def run_nodejs command
63
- raise "Not yet implemented"
43
+ self.send("run_#{ @config['getter'].get_current_sub_stack }", command)
44
+ end
45
+
46
+ def run_meteor command
47
+ run_command(command, __method__.to_s, '/usr/local/bin/meteor', true)
64
48
  end
65
49
 
66
50
  def run_wordpress command
@@ -72,9 +56,34 @@ class Cheftacular
72
56
  end
73
57
 
74
58
  def run_ command
75
- puts "Run method tried to run a command for the role \"#{ @options['role'] }\" but it doesn't appear to have a repository set! Skipping..."
59
+ puts "Run method tried to run a command for the role \"#{ @options['role'] }\" but it doesn't appear to have a repository or stack set! Skipping..."
76
60
 
77
61
  return false
78
62
  end
63
+
64
+ alias_method :meteor, :run
65
+
66
+ private
67
+
68
+ def run_command command, descriptor, executable, sudo=false
69
+ nodes = @config['getter'].get_current_role_nodes
70
+
71
+ #this must always precede on () calls so they have the instance variables they need
72
+ options, locs, ridley, logs_bag_hash, pass_bag_hash, bundle_command, cheftacular, passwords = @config['helper'].set_local_instance_vars
73
+
74
+ on ( nodes.map { |n| @config['cheftacular']['deploy_user'] + "@" + n.public_ipaddress } ) do |host|
75
+ n = get_node_from_address(nodes, host.hostname)
76
+
77
+ puts("Beginning #{ descriptor } run for #{ n.name } (#{ n.public_ipaddress }) on role #{ options['role'] }") unless options['quiet']
78
+
79
+ log_data, timestamp, exit_status = start_task( n.name, n.public_ipaddress, n.run_list, "#{ executable } #{ command }", options, locs, cheftacular, passwords, sudo)
80
+
81
+ logs_bag_hash["#{ n.name }-#{ descriptor }"] = { "text" => log_data.scrub_pretty_text, "timestamp" => timestamp, "exit_status" => exit_status }
82
+ end
83
+
84
+ @config['ChefDataBag'].save_logs_bag
85
+
86
+ @config['helper'].send_log_bag_hash_slack_notification(logs_bag_hash, __method__, 'Failing command detected, exiting...')
87
+ end
79
88
  end
80
89
  end
@@ -59,6 +59,12 @@ class Cheftacular
59
59
  `ssh -oStrictHostKeyChecking=no -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "#{ @config['helper'].sudo(ip_address) } tail -f #{ log_loc } #{ get_tail_grep_string(pattern_to_match) }" > /dev/tty`
60
60
  end
61
61
 
62
+ def start_tail_nodejs ip_address, run_list, pattern_to_match
63
+ log_loc = "/var/log/syslog"
64
+
65
+ `ssh #{ Cheftacular::SSH_INLINE_VARS } -tt #{ @config['cheftacular']['deploy_user'] }@#{ ip_address } "#{ @config['helper'].sudo(ip_address) } tail -f #{ log_loc } #{ get_tail_grep_string(pattern_to_match) }" > /dev/tty`
66
+ end
67
+
62
68
  def get_tail_grep_string pattern_to_match=''
63
69
  "| grep -i -E \\\"#{ pattern_to_match }\\\"" unless pattern_to_match.blank?
64
70
  end
@@ -27,9 +27,17 @@ require 'csv'
27
27
  Dir["#{File.dirname(__FILE__)}/../**/*.rb"].each { |f| require f }
28
28
 
29
29
  class Cheftacular
30
+ SSH_INLINE_VARS = '-oStrictHostKeyChecking=no -oServerAliveInterval=60'
31
+
30
32
  def initialize options={'env'=>'staging'}, config={}
31
33
  @options, @config = options, config
34
+
32
35
  SSHKit.config.format = :blackhole
36
+ SSHKit::Backend::Netssh.configure do |ssh|
37
+ ssh.connection_timeout = 30
38
+ ssh.ssh_options = { keepalive: true, keepalive_interval: 60 }
39
+ end
40
+
33
41
  Excon.defaults[:ssl_verify_peer] = false #https://github.com/excon/excon/issues/479 # issues with cert bundle chains
34
42
  #Fog::Logger[:warning] = nil
35
43
  @config['start_time'] = Time.now
@@ -91,6 +91,10 @@ class Cheftacular
91
91
  get_current_repo_config['stack']
92
92
  end
93
93
 
94
+ def get_current_sub_stack
95
+ get_current_repo_config['sub_stack']
96
+ end
97
+
94
98
  def get_current_database
95
99
  get_current_repo_config['database']
96
100
  end
@@ -157,8 +161,17 @@ class Cheftacular
157
161
  ret
158
162
  end
159
163
 
160
- def get_repo_names_for_repositories ret={}
164
+ def get_repo_names_for_repositories restrict_to={}, ret={}
161
165
  @config['cheftacular']['repositories'].each_pair do |name, repo_hash|
166
+ unless restrict_to.empty?
167
+ skip = false
168
+ restrict_to.each_pair do |key, val|
169
+ skip = true if repo_hash[key.to_s] == val
170
+ end
171
+
172
+ next if skip
173
+ end
174
+
162
175
  ret[repo_hash['repo_name']] = repo_hash
163
176
 
164
177
  ret[repo_hash['repo_name']]['role'] = name
@@ -173,5 +186,13 @@ class Cheftacular
173
186
 
174
187
  ret
175
188
  end
189
+
190
+ def get_current_role_nodes
191
+ nodes = @config['parser'].exclude_nodes( @config['getter'].get_true_node_objects, [{ unless: "role[#{ @options['role'] }]" }], !@options['run_on_all'] )
192
+
193
+ nodes = @config['parser'].exclude_nodes( nodes, [{ if: "role[#{ @options['negative_role'] }]" }]) if @options['negative_role']
194
+
195
+ nodes
196
+ end
176
197
  end
177
198
  end
@@ -259,7 +259,7 @@ class Cheftacular
259
259
  end
260
260
 
261
261
  def slack_current_deploy_arguments
262
- msg = "#{ Socket.gethostname } just set for the repository #{ @config['getter'].get_repository_from_role_name(@options['role']) }:\n"
262
+ msg = "#{ Socket.gethostname }(#{ @config['locs']['root'] }) just set for the repository #{ @config['getter'].get_repository_from_role_name(@options['role']) }:\n"
263
263
  msg << "the organization to #{ @options['deploy_organization'] }\n" if @options['deploy_organization']
264
264
  msg << "the revision to #{ @options['target_revision'] }\n" if @options['target_revision']
265
265
  msg << "In the environment: #{ @options['env'] }"
@@ -1,5 +1,5 @@
1
1
  class Cheftacular
2
2
  #major_version.minor_version.bugfixes
3
- VERSION = "2.13.1"
3
+ VERSION = "2.13.2"
4
4
  RUBY_VERSION = "2.2.2"
5
5
  end
@@ -19,6 +19,16 @@ class CloudInteractor
19
19
  @main_obj['output']["records_for_#{ @main_obj["specific_#{ IDENTITY }"].last['domain'] }"] = @main_obj["specific_#{ IDENTITY }"].last['records']
20
20
 
21
21
  ap(@main_obj["specific_#{ IDENTITY }"].last['records']) if output
22
+ rescue Excon::Errors::Timeout => e
23
+ tries ||= 3
24
+ puts "Issue reading records for the domain #{ args['domain'] }! Error: #{e}. Trying #{tries} more times."
25
+ tries -= 1
26
+ if tries > 0
27
+ sleep(15)
28
+ retry
29
+ else
30
+ false
31
+ end
22
32
  end
23
33
  end
24
34
  end
@@ -26,17 +26,31 @@ class CloudInteractor
26
26
 
27
27
  case @options['route_dns_changes_via']
28
28
  when /rackspace|dnsimple/
29
- specific_record.type = args['type']
30
- specific_record.value = args['target_ip']
31
- specific_record.ttl = args['ttl']
32
-
33
- specific_record.save
29
+ begin
30
+ specific_record.type = args['type']
31
+ specific_record.value = args['target_ip']
32
+ specific_record.ttl = args['ttl']
33
+
34
+ specific_record.save
35
+ rescue Fog::Errors::Error => e
36
+ tries ||= 3
37
+ puts "Issue updating records for the domain #{ args[IDENTITY.singularize] }! Error: #{e}. Trying #{tries} more times."
38
+ tries -= 1
39
+ if tries > 0
40
+ sleep(15)
41
+ retry
42
+ else
43
+ false
44
+ end
45
+ end
34
46
  else
35
47
  raise "Unsupported action #{ __method__ } for #{ @options['preferred_cloud'] }. Please create an issue on github or submit a PR to fix this issue."
36
48
  end
37
49
 
38
50
  puts "(#{ IDENTITY.capitalize }) Updated #{ args['subdomain'] } (#{ args['target_ip'] }) to #{ args[IDENTITY.singularize] } (#{ args['target_domain'] })..."
39
51
  else
52
+ tries = 3
53
+
40
54
  create_record [ args ]
41
55
  end
42
56
  end
@@ -19,6 +19,16 @@ class CloudInteractor
19
19
  @main_obj[identity] = JSON.parse(@classes['auth'].auth_service(resource).instance_eval(identity).to_json)
20
20
 
21
21
  ap(@main_obj[identity]) if output && !@options['in_scaling']
22
+ rescue Excon::Errors::Timeout => e
23
+ tries ||= 3
24
+ puts "Issue reading data for the #{ identity.capitalize }! Error: #{e}. Trying #{tries} more times."
25
+ tries -= 1
26
+ if tries > 0
27
+ sleep(15)
28
+ retry
29
+ else
30
+ false
31
+ end
22
32
  end
23
33
 
24
34
  def generic_read_parse args, identity, output=true, mode='name', search_key='name'
@@ -1,4 +1,4 @@
1
1
  class CloudInteractor
2
2
  #major_version.minor_version.bugfixes
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
@@ -1,7 +1,7 @@
1
1
  module SSHKit
2
2
  module Backend
3
3
  class Netssh
4
- def start_task name, ip_address, run_list, command, options, locs, cheftacular, passwords, out=""
4
+ def start_task name, ip_address, run_list, command, options, locs, cheftacular, passwords, sudo=false, out=""
5
5
  log_loc, timestamp = set_log_loc_and_timestamp(locs)
6
6
  true_env = get_true_environment run_list, cheftacular['run_list_environments'][options['env']], options['env']
7
7
 
@@ -15,11 +15,12 @@ module SSHKit
15
15
  return ['', timestamp]
16
16
  end
17
17
 
18
- capture_args = ["RAILS_ENV=#{ true_env }"]
18
+ capture_args = []
19
+ capture_args << ["RAILS_ENV=#{ true_env }"] if cheftacular['repositories'][options['role']]['stack'] == 'ruby_on_rails'
19
20
  capture_args << command.split(' ')
20
21
 
21
22
  within target_loc do
22
- out << capture( *capture_args.flatten )
23
+ out << (sudo ? sudo_capture(passwords[ip_address], *capture_args.flatten) : capture( *capture_args.flatten ))
23
24
  end
24
25
 
25
26
  ::File.open("#{ log_loc }/#{ name }-task-#{ timestamp }.txt", "w") {|f| f.write(out.scrub_pretty_text) } if options['debug']
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.13.1
4
+ version: 2.13.2
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-02-02 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -252,6 +252,7 @@ files:
252
252
  - lib/cheftacular.rb
253
253
  - lib/cheftacular/README.md
254
254
  - lib/cheftacular/action.rb
255
+ - lib/cheftacular/actions/backups.rb
255
256
  - lib/cheftacular/actions/check.rb
256
257
  - lib/cheftacular/actions/console.rb
257
258
  - lib/cheftacular/actions/db_console.rb
@@ -281,7 +282,6 @@ files:
281
282
  - lib/cheftacular/stateless_action.rb
282
283
  - lib/cheftacular/stateless_actions/add_ssh_key_to_bag.rb
283
284
  - lib/cheftacular/stateless_actions/arguments.rb
284
- - lib/cheftacular/stateless_actions/backups.rb
285
285
  - lib/cheftacular/stateless_actions/bootstrappers/centos_bootstrap_from_queue.rb
286
286
  - lib/cheftacular/stateless_actions/bootstrappers/coreos_bootstrap_from_queue.rb
287
287
  - lib/cheftacular/stateless_actions/bootstrappers/fedora_bootstrap_from_queue.rb