Class: PuppetdbHost
- Inherits:
-
Object
- Object
- PuppetdbHost
- Defined in:
- app/services/puppetdb_host.rb
Instance Attribute Summary collapse
-
#certname ⇒ Object
Returns the value of attribute certname.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#facts ⇒ Object
Returns the value of attribute facts.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ PuppetdbHost
constructor
A new instance of PuppetdbHost.
- #to_host ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ PuppetdbHost
Returns a new instance of PuppetdbHost.
6 7 8 9 |
# File 'app/services/puppetdb_host.rb', line 6 def initialize(opts = {}) self.facts = HashWithIndifferentAccess.new parse_facts(opts.fetch(:facts)) end |
Instance Attribute Details
#certname ⇒ Object
Returns the value of attribute certname.
4 5 6 |
# File 'app/services/puppetdb_host.rb', line 4 def certname @certname end |
#environment ⇒ Object
Returns the value of attribute environment.
4 5 6 |
# File 'app/services/puppetdb_host.rb', line 4 def environment @environment end |
#facts ⇒ Object
Returns the value of attribute facts.
4 5 6 |
# File 'app/services/puppetdb_host.rb', line 4 def facts @facts end |
Instance Method Details
#to_host ⇒ Object
11 12 13 14 15 16 |
# File 'app/services/puppetdb_host.rb', line 11 def to_host host = Host::Managed.import_host(facts[:fqdn], certname) HostFactImporter.new(host).import_facts(facts) host.update_attribute(environment: environment) if environment # rubocop:disable Rails/SkipsModelValidations host end |