Class: BoltServer::Plugin::PuppetConnectData
- Inherits:
-
Object
- Object
- BoltServer::Plugin::PuppetConnectData
- Defined in:
- lib/bolt_server/plugin/puppet_connect_data.rb
Instance Method Summary collapse
- #hooks ⇒ Object
-
#initialize(data, **_opts) ⇒ PuppetConnectData
constructor
A new instance of PuppetConnectData.
- #name ⇒ Object
- #resolve_reference(opts) ⇒ Object
- #validate_resolve_reference(opts) ⇒ Object
Constructor Details
#initialize(data, **_opts) ⇒ PuppetConnectData
Returns a new instance of PuppetConnectData.
6 7 8 |
# File 'lib/bolt_server/plugin/puppet_connect_data.rb', line 6 def initialize(data, **_opts) @data = data end |
Instance Method Details
#hooks ⇒ Object
14 15 16 |
# File 'lib/bolt_server/plugin/puppet_connect_data.rb', line 14 def hooks %i[resolve_reference validate_resolve_reference] end |
#name ⇒ Object
10 11 12 |
# File 'lib/bolt_server/plugin/puppet_connect_data.rb', line 10 def name 'puppet_connect_data' end |
#resolve_reference(opts) ⇒ Object
18 19 20 21 22 |
# File 'lib/bolt_server/plugin/puppet_connect_data.rb', line 18 def resolve_reference(opts) key = opts['key'] @data.dig(key, 'value') end |
#validate_resolve_reference(opts) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bolt_server/plugin/puppet_connect_data.rb', line 24 def validate_resolve_reference(opts) unless opts['key'] raise Bolt::ValidationError, "puppet_connect_data plugin requires that 'key' be specified" end unless @data.key?(opts['key']) raise Bolt::ValidationError, "puppet_connect_data plugin tried to lookup key '#{opts['key']}' but no value was found" end end |