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

Instance Method Summary collapse

Methods inherited from Bolt::Task

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

Constructor Details

#initialize(task_data, file_cache) ⇒ PuppetServer

Returns a new instance of PuppetServer.



8
9
10
11
12
# File 'lib/bolt/task/puppet_server.rb', line 8

def initialize(task_data, file_cache)
  @file_cache = file_cache
  task_data = update_file_data(task_data)
  super(task_data)
end

Instance Method Details

#file_path(file_name) ⇒ Object

Compute local path and download files from puppetserver as needed



21
22
23
24
# File 'lib/bolt/task/puppet_server.rb', line 21

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

#update_file_data(task_data) ⇒ Object

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



15
16
17
18
# File 'lib/bolt/task/puppet_server.rb', line 15

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