Method: ChefApply::Startup#run
- Defined in:
- lib/chef_apply/startup.rb
#run ⇒ Object
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/chef_apply/startup.rb', line 36 def run # Some tasks we do only once in an installation: first_run_tasks # Call this every time, so that if we add or change ~/.chef-workstation # directory structure, we can be sure that it exists. Even with a # custom configuration, the .chef-workstation directory and subdirs # are required. setup_workstation_user_directories # Customize behavior of Ruby and any gems around error handling setup_error_handling # Startup tasks that may change behavior based on configuration value # must be run after load_config load_config # Init logging using log level out of config setup_logging # Begin upload of previous session telemetry. (If telemetry is not enabled, # in config the uploader will clean up previous session(s) without sending) start_telemeter_upload # Launch the actual Chef Apply behavior start_chef_apply # NOTE: Because these exceptions occur outside of the # CLI handling, they won't be tracked in telemtry. # We can revisit this once the pending error handling rework # is underway. rescue ConfigPathInvalid => e UI::Terminal.output(T.error.bad_config_file(e.path)) rescue ConfigPathNotProvided UI::Terminal.output(T.error.missing_config_path) rescue Mixlib::Config::UnknownConfigOptionError => e # Ideally we'd update the exception in mixlib to include # a field with the faulty value, line number, and nested context - # it's less fragile than depending on text parsing, which # is what we'll do for now. if e. =~ /.*unsupported config value (.*)[.]+$/ # TODO - levenshteinian distance to figure out # what they may have meant instead. UI::Terminal.output(T.error.invalid_config_key($1, Config.location)) else # Safety net in case the error text changes from under us. UI::Terminal.output(T.error.unknown_config_error(e., Config.location)) end rescue Tomlrb::ParseError => e UI::Terminal.output(T.error.unknown_config_error(e., Config.location)) end |