Class: RSpecSystem::Helpers::PuppetResource
- Inherits:
-
RSpecSystem::Helper
- Object
- RSpecSystem::Helper
- RSpecSystem::Helpers::PuppetResource
- Defined in:
- lib/rspec-system-puppet/helpers/puppet_resource.rb
Instance Method Summary collapse
-
#execute ⇒ Hash
Run puppet resource in a shell and return results.
-
#initialize(opts, clr, &block) ⇒ PuppetResource
constructor
A new instance of PuppetResource.
Constructor Details
#initialize(opts, clr, &block) ⇒ PuppetResource
Returns a new instance of PuppetResource.
8 9 10 11 |
# File 'lib/rspec-system-puppet/helpers/puppet_resource.rb', line 8 def initialize(opts, clr, &block) raise "Must provide resource" unless opts[:resource] super(opts, clr, &block) end |
Instance Method Details
#execute ⇒ Hash
Run puppet resource in a shell and return results
16 17 18 19 20 21 22 23 |
# File 'lib/rspec-system-puppet/helpers/puppet_resource.rb', line 16 def execute resource = opts[:resource] node = opts[:node] log.info("Now running puppet resource") result = shell :c => "puppet resource #{resource}", :n => node result.to_hash end |