Class: HttpdConfigmapGenerator::Update

Inherits:
Base
  • Object
show all
Defined in:
lib/httpd_configmap_generator/update.rb

Constant Summary

Constants inherited from Base

Base::APACHE_USER, Base::HTTP_KEYTAB, Base::IPA_COMMAND, Base::KERBEROS_CONFIG_FILE, Base::LDAP_ATTRS, Base::PAM_CONFIG, Base::SSSD_CONFIG, Base::TIMESTAMP_FORMAT

Constants included from Base::Network

Base::Network::HOSTNAME_COMMAND

Instance Attribute Summary

Attributes inherited from Base

#opts

Instance Method Summary collapse

Methods inherited from Base

#debug_msg, #err_msg, #info_msg, #initialize, #run_configure

Methods included from Base::Pam

#configure_pam

Methods included from Base::Network

#domain, #domain_from_host, #fetch_network_file, #host_reachable?, #realm, #update_hostname

Methods included from Base::Kerberos

#enable_kerberos_dns_lookups

Methods included from Base::FileHelper

#cp_template, #create_target_directory, #delete_target_file, #file_binary?, #path_join, #rm_file, #template_directory

Methods included from Base::ConfigHelper

#config_file_backup

Methods included from Base::Command

#command_run, #command_run!, #log_command_error

Constructor Details

This class inherits a constructor from HttpdConfigmapGenerator::Base

Instance Method Details

#optional_optionsObject



12
13
14
15
16
17
18
# File 'lib/httpd_configmap_generator/update.rb', line 12

def optional_options
  super.merge(
    :add_file => { :description => "Add file to config map",
                   :short       => "-a",
                   :multi       => true }
  )
end

#required_optionsObject



3
4
5
6
7
8
9
10
# File 'lib/httpd_configmap_generator/update.rb', line 3

def required_options
  {
    :input  => { :description => "Input config map file",
                 :short       => "-i" },
    :output => { :description => "Output config map file",
                 :short       => "-o" }
  }
end

#update(opts) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/httpd_configmap_generator/update.rb', line 20

def update(opts)
  validate_options(opts)
  @opts = opts
  config_map = ConfigMap.new(opts)
  config_map.load(opts[:input])
  config_map.add_files(opts[:add_file])
  config_map.save(opts[:output])
rescue => err
  log_command_error(err)
  raise err
end