Class: ChefApply::Config
- Inherits:
-
Object
- Object
- ChefApply::Config
- Extended by:
- Mixlib::Config
- Defined in:
- lib/chef_apply/config.rb
Constant Summary collapse
- WS_BASE_PATH =
File.join(Dir.home, ".chef-workstation/")
- SUPPORTED_PROTOCOLS =
%w{ssh winrm}.freeze
Class Method Summary collapse
- .base_log_directory ⇒ Object
- .custom_location(path) ⇒ Object
- .default_location ⇒ Object
-
.error_output_path ⇒ Object
These paths are relative to the log output path, which is user-configurable.
- .exist? ⇒ Boolean
-
.initialize_mixlib_config ⇒ Object
Ensure when we extend Mixlib::Config that we load up the workstation config since we will need that to converge later.
- .load ⇒ Object
- .location ⇒ Object
- .reset ⇒ Object
- .stack_trace_path ⇒ Object
- .telemetry_installation_identifier_file ⇒ Object
- .telemetry_path ⇒ Object
- .telemetry_session_file ⇒ Object
- .using_default_location? ⇒ Boolean
Class Method Details
.base_log_directory ⇒ Object
61 62 63 |
# File 'lib/chef_apply/config.rb', line 61 def base_log_directory File.dirname(log.location) end |
.custom_location(path) ⇒ Object
40 41 42 43 |
# File 'lib/chef_apply/config.rb', line 40 def custom_location(path) @custom_location = path raise "No config file located at #{path}" unless exist? end |
.default_location ⇒ Object
45 46 47 |
# File 'lib/chef_apply/config.rb', line 45 def default_location File.join(WS_BASE_PATH, "config.toml") end |
.error_output_path ⇒ Object
These paths are relative to the log output path, which is user-configurable.
66 67 68 |
# File 'lib/chef_apply/config.rb', line 66 def error_output_path File.join(base_log_directory, "errors.txt") end |
.exist? ⇒ Boolean
88 89 90 |
# File 'lib/chef_apply/config.rb', line 88 def exist? File.exist? location end |
.initialize_mixlib_config ⇒ Object
Ensure when we extend Mixlib::Config that we load up the workstation config since we will need that to converge later
36 37 38 |
# File 'lib/chef_apply/config.rb', line 36 def initialize_mixlib_config super end |
.load ⇒ Object
82 83 84 85 86 |
# File 'lib/chef_apply/config.rb', line 82 def load if exist? from_file(location) end end |
.location ⇒ Object
78 79 80 |
# File 'lib/chef_apply/config.rb', line 78 def location using_default_location? ? default_location : @custom_location end |
.reset ⇒ Object
92 93 94 95 |
# File 'lib/chef_apply/config.rb', line 92 def reset @custom_location = nil super end |
.stack_trace_path ⇒ Object
70 71 72 |
# File 'lib/chef_apply/config.rb', line 70 def stack_trace_path File.join(base_log_directory, "stack-trace.log") end |
.telemetry_installation_identifier_file ⇒ Object
57 58 59 |
# File 'lib/chef_apply/config.rb', line 57 def telemetry_installation_identifier_file File.join(WS_BASE_PATH, "installation_id") end |
.telemetry_path ⇒ Object
49 50 51 |
# File 'lib/chef_apply/config.rb', line 49 def telemetry_path File.join(WS_BASE_PATH, "telemetry") end |
.telemetry_session_file ⇒ Object
53 54 55 |
# File 'lib/chef_apply/config.rb', line 53 def telemetry_session_file File.join(telemetry_path, "TELEMETRY_SESSION_ID") end |
.using_default_location? ⇒ Boolean
74 75 76 |
# File 'lib/chef_apply/config.rb', line 74 def using_default_location? @custom_location.nil? end |