Class: Bolt::Task::PuppetServer

Inherits:
Bolt::Task
  • Object
show all
Defined in:
lib/bolt/task/puppet_server.rb

Instance Attribute Summary

Attributes inherited from Bolt::Task

#file, #files, #metadata, #name, #remote

Instance Method Summary collapse

Methods inherited from Bolt::Task

#description, #implementations, #module_name, #parameters, #select_implementation, #supports_noop, #tasks_dir

Constructor Details

#initialize(task, file_cache, **opts) ⇒ PuppetServer

Returns a new instance of PuppetServer.



12
13
14
15
16
# File 'lib/bolt/task/puppet_server.rb', line 12

def initialize(task, file_cache, **opts)
  super(task, **opts)
  @file_cache = file_cache
  update_file_data(task)
end

Instance Method Details

#file_path(file_name) ⇒ Object



24
25
26
27
# File 'lib/bolt/task/puppet_server.rb', line 24

def file_path(file_name)
  file = file_map[file_name]
  file['path'] ||= @file_cache.update_file(file)
end

#remote_instanceObject



6
7
8
9
10
# File 'lib/bolt/task/puppet_server.rb', line 6

def remote_instance
  self.class.new(to_h.each_with_object({}) { |(k, v), h| h[k.to_s] = v },
                 @file_cache,
                 remote: true)
end

#update_file_data(task_data) ⇒ Object

puppetserver file entries have ‘filename’ rather then ‘name’



19
20
21
22
# File 'lib/bolt/task/puppet_server.rb', line 19

def update_file_data(task_data)
  task_data['files'].each { |f| f['name'] = f['filename'] }
  task_data
end