Class: Simp::Cli::Config::Item::Certificates
- Inherits:
-
ActionItem
- Object
- Simp::Cli::Config::Item
- ActionItem
- Simp::Cli::Config::Item::Certificates
- Defined in:
- lib/simp/cli/config/item/certificates.rb
Instance Attribute Summary collapse
-
#dirs ⇒ Object
Returns the value of attribute dirs.
Attributes inherited from Simp::Cli::Config::Item
#allow_user_apply, #config_items, #description, #die_on_apply_fail, #fact, #fail_on_missing_answer, #key, #next_items_tree, #silent, #skip_apply, #skip_query, #skip_yaml, #value
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize ⇒ Certificates
constructor
A new instance of Certificates.
Methods inherited from ActionItem
Methods included from SafeApplying
Methods inherited from Simp::Cli::Config::Item
#default_value, #highline_question_type, #next_items, #not_valid_message, #os_value, #print_banner, #print_summary, #puppet_value, #query, #query_ask, #query_extras, #query_status, #recommended_value, #safe_apply, #say_blue, #say_green, #say_red, #say_yellow, #to_yaml_s, #validate
Constructor Details
#initialize ⇒ Certificates
Returns a new instance of Certificates.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/simp/cli/config/item/certificates.rb', line 11 def initialize super @key = 'certificates' @description = %Q{Sets up the cerificates for SIMP on apply. (apply-only; noop)} @dirs = { :keydist => '/etc/puppet/environments/simp/keydist', :fake_ca => '/etc/puppet/environments/simp/FakeCA', } @die_on_apply_fail = true end |
Instance Attribute Details
#dirs ⇒ Object
Returns the value of attribute dirs.
10 11 12 |
# File 'lib/simp/cli/config/item/certificates.rb', line 10 def dirs @dirs end |
Instance Method Details
#apply ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/simp/cli/config/item/certificates.rb', line 23 def apply # Certificate Management say_green 'Checking system certificates...' if !@silent hostname = @config_items.fetch( 'hostname' ).value if !( File.exist?("#{@dirs[:keydist]}/#{hostname}/#{hostname}.pub") && File.exist?("#{@dirs[:keydist]}/#{hostname}/#{hostname}.pem") ) say_green "INFO: No certificates were found for '#{hostname}, generating..." if !@silent Simp::Cli::Config::Utils.generate_certificates([hostname], @dirs[:fake_ca]) else say_yellow "WARNING: Found existing certificates for #{hostname}, not recreating" if !@silent end end |