Class: Cheftacular

Inherits:
Object
  • Object
show all
Defined in:
lib/cheftacular/actions/scale.rb,
lib/cheftacular.rb,
lib/cheftacular/dns.rb,
lib/cheftacular/error.rb,
lib/cheftacular/action.rb,
lib/cheftacular/getter.rb,
lib/cheftacular/helper.rb,
lib/cheftacular/parser.rb,
lib/cheftacular/auditor.rb,
lib/cheftacular/version.rb,
lib/cheftacular/decryptor.rb,
lib/cheftacular/encryptor.rb,
lib/cheftacular/actions/log.rb,
lib/cheftacular/actions/run.rb,
lib/cheftacular/cheftacular.rb,
lib/cheftacular/file_system.rb,
lib/cheftacular/initializer.rb,
lib/cheftacular/actions/tail.rb,
lib/cheftacular/queue_master.rb,
lib/cheftacular/actions/check.rb,
lib/cheftacular/chef/data_bag.rb,
lib/cheftacular/actions/deploy.rb,
lib/cheftacular/cloud_provider.rb,
lib/cheftacular/actions/console.rb,
lib/cheftacular/actions/migrate.rb,
lib/cheftacular/stateless_action.rb,
lib/cheftacular/actions/db_console.rb,
lib/cheftacular/initialization_action.rb,
lib/cheftacular/stateless_actions/rvm.rb,
lib/cheftacular/stateless_actions/file.rb,
lib/cheftacular/stateless_actions/help.rb,
lib/cheftacular/stateless_actions/pass.rb,
lib/cheftacular/stateless_actions/cloud.rb,
lib/cheftacular/stateless_actions/slack.rb,
lib/cheftacular/stateless_actions/backups.rb,
lib/cheftacular/stateless_actions/service.rb,
lib/cheftacular/stateless_actions/test_env.rb,
lib/cheftacular/stateless_actions/arguments.rb,
lib/cheftacular/stateless_actions/reset_bag.rb,
lib/cheftacular/stateless_actions/update_tld.rb,
lib/cheftacular/stateless_actions/chef_server.rb,
lib/cheftacular/stateless_actions/client_list.rb,
lib/cheftacular/stateless_actions/disk_report.rb,
lib/cheftacular/stateless_actions/environment.rb,
lib/cheftacular/stateless_actions/get_pg_pass.rb,
lib/cheftacular/stateless_actions/role_toggle.rb,
lib/cheftacular/stateless_actions/clear_caches.rb,
lib/cheftacular/stateless_actions/knife_upload.rb,
lib/cheftacular/stateless_actions/reinitialize.rb,
lib/cheftacular/stateless_actions/restart_swap.rb,
lib/cheftacular/stateless_actions/upload_nodes.rb,
lib/cheftacular/stateless_actions/upload_roles.rb,
lib/cheftacular/stateless_actions/remove_client.rb,
lib/cheftacular/stateless_actions/server_update.rb,
lib/cheftacular/stateless_actions/chef_bootstrap.rb,
lib/cheftacular/stateless_actions/compile_readme.rb,
lib/cheftacular/stateless_actions/create_git_key.rb,
lib/cheftacular/stateless_actions/full_bootstrap.rb,
lib/cheftacular/stateless_actions/clean_cookbooks.rb,
lib/cheftacular/stateless_actions/cloud_bootstrap.rb,
lib/cheftacular/stateless_actions/fix_known_hosts.rb,
lib/cheftacular/stateless_actions/get_haproxy_log.rb,
lib/cheftacular/stateless_actions/get_log_from_bag.rb,
lib/cheftacular/stateless_actions/location_aliases.rb,
lib/cheftacular/stateless_actions/cleanup_log_files.rb,
lib/cheftacular/stateless_actions/compile_audit_log.rb,
lib/cheftacular/stateless_actions/add_ssh_key_to_bag.rb,
lib/cheftacular/stateless_actions/cheftacular_config.rb,
lib/cheftacular/stateless_actions/replication_status.rb,
lib/cheftacular/stateless_actions/update_chef_client.rb,
lib/cheftacular/stateless_actions/cheftacular_yml_help.rb,
lib/cheftacular/stateless_actions/list_toggleable_roles.rb,
lib/cheftacular/stateless_actions/update_split_branches.rb,
lib/cheftacular/stateless_actions/clean_server_passwords.rb,
lib/cheftacular/stateless_actions/check_cheftacular_yml_keys.rb,
lib/cheftacular/stateless_actions/get_active_ssh_connections.rb,
lib/cheftacular/stateless_actions/initialize_cheftacular_yml.rb,
lib/cheftacular/stateless_actions/initialize_data_bag_contents.rb,
lib/cheftacular/stateless_actions/update_thecheftacularcookbook.rb,
lib/cheftacular/stateless_actions/bootstrappers/centos_bootstrap.rb,
lib/cheftacular/stateless_actions/bootstrappers/coreos_bootstrap.rb,
lib/cheftacular/stateless_actions/bootstrappers/fedora_bootstrap.rb,
lib/cheftacular/stateless_actions/bootstrappers/redhat_bootstrap.rb,
lib/cheftacular/stateless_actions/bootstrappers/ubuntu_bootstrap.rb,
lib/cheftacular/stateless_actions/bootstrappers/vyatta_bootstrap.rb,
lib/cheftacular/stateless_actions/update_cloudflare_dns_from_cloud.rb,
lib/cheftacular/stateless_actions/get_shorewall_allowed_connections.rb

Overview

refresh the authorized_keys in the authentication data bag from the chef server

Defined Under Namespace

Classes: Action, ActionDocumentation, Auditor, ChefDataBag, CloudProvider, DNS, Decryptor, Encryptor, Error, FileSystem, Getter, Helper, InitializationAction, Initializer, Parser, QueueMaster, StatelessAction, StatelessActionDocumentation

Constant Summary collapse

VERSION =

major_version.minor_version.bugfixes

"2.9.1"
RUBY_VERSION =
"2.2.2"

Instance Method Summary collapse

Constructor Details

#initialize(options = {'env'=>'staging'}, config = {}) ⇒ Cheftacular



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cheftacular/cheftacular.rb', line 29

def initialize options={'env'=>'staging'}, config={}
  @options, @config                = options, config
  SSHKit.config.format             = :blackhole
  #Fog::Logger[:warning]            = nil
  @config['start_time']            = Time.now
  @config['helper']                = Helper.new(@options, @config)
  @config['initialization_action'] = InitializationAction.new(@options, @config)
  @config['filesystem']            = Cheftacular::FileSystem.new(@options, @config)
  @config['initializer']           = Initializer.new(@options, @config)

  if @config['helper'].is_initialization_command?(ARGV[0])
    @options['command'] = ARGV[0] #this is normally set by parse_context but that is not run for initialization commands
  else
    #@config['stateless_action'].cheftacular_config('sync') unless @config['helper'].running_on_chef_node?

    @config['stateless_action'].initialize_data_bag_contents(@options['env']) #ensure basic structure are always maintained before each run

    @config['parser'].parse_application_context if @config['helper'].running_in_mode?('application')

    @config['parser'].parse_context

    puts("Preparing to run command \"#{ @options['command'] }\"...") if @options['verbose']

    @config['auditor'].audit_run if @config['cheftacular']['auditing']
  end

  @config['stateless_action'].check_cheftacular_yml_keys unless @config['helper'].is_initialization_command?(ARGV[0])

  @config['action'].send(@options['command']) if @config['helper'].is_command?(@options['command'])

  @config['stateless_action'].send(@options['command']) if @config['helper'].is_stateless_command?(@options['command'])

  @config['stateless_action'].send('help') if @config['helper'].is_not_command_or_stateless_command?(@options['command'])

  @config['queue_master'].work_off_slack_queue unless @config['helper'].is_initialization_command?(@options['command'])

  @config['helper'].output_run_stats

  exit #explicitly call this in case some celluoid workers are still hanging around
end