run_command: support an array of commands #5678
Annotations
3 errors and 2 warnings
bolt-modules/boltlib/spec/functions/run_command_spec.rb#L182
run_command it calls bolt executor run_command without targets - does not invoke bolt
Failure/Error:
is_expected.to run
.with_params(command, [])
.and_return(Bolt::ResultSet.new([]))
expected run_command("hostname", []) to have returned #<Bolt::ResultSet:0x000001aaf1c09610 @results=[]> instead of raising Puppet::Pops::Types::TypeAssertionError(value returned from function 'run_command' has wrong type, expects an Object[{name => 'ResultSet', attributes => {'results' => Array[Variant[Result, ApplyResult]]}, functions => {'count' => Callable[[0, 0], Integer], 'empty' => Callable[[0, 0], Boolean], 'error_set' => Callable[[0, 0], ResultSet], 'filter_set' => Callable[[0, 0, Callable], ResultSet], 'find' => Callable[[String[1]], Optional[Variant[Result, ApplyResult]]], 'first' => Callable[[0, 0], Optional[Variant[Result, ApplyResult]]], 'names' => Callable[[0, 0], Array[String[1]]], 'ok' => Callable[[0, 0], Boolean], 'ok_set' => Callable[[0, 0], ResultSet], 'targets' => Callable[[0, 0], Array[Target]], 'to_data' => Callable[[0, 0], Array[Hash]], '[]' => Variant[Callable[[Integer], Optional[Variant[Result, ApplyResult, Array[Variant[Result, ApplyResult]]]]], Callable[[Integer, Integer], Optional[Variant[Result, ApplyResult, Array[Variant[Result, ApplyResult]]]]]]}}] value, got Object[{name => 'Result', attributes => {'value' => Hash[String[1], Data], 'target' => Target}, functions => {'error' => Callable[[0, 0], Optional[Error]], 'message' => Callable[[0, 0], Optional[String]], 'sensitive' => Callable[[0, 0], Optional[Sensitive[Data]]], 'action' => Callable[[0, 0], String], 'status' => Callable[[0, 0], String], 'to_data' => Callable[[0, 0], Hash], 'ok' => Callable[[0, 0], Boolean], '[]' => Callable[[String[1]], Variant[Data, Sensitive[Data]]]}}])
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/types/type_asserter.rb:41:in `report_type_mismatch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/types/type_asserter.rb:33:in `assert_instance_of'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatch.rb:62:in `invoke'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:47:in `block in dispatch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:46:in `catch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:46:in `dispatch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:43:in `block in call'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:42:in `catch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:42:in `call'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/example/function_example_group.rb:21:in `block in execute'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/context.rb:62:in `override'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet.rb:289:in `override'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/example/function_example_group.rb:20:in `execute'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/matchers/run.rb:12:in `matches?'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:51:in `block in handle_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:27:in `with_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/expectation_target.rb:65:in `to'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/expectation_target.rb:101:in `t
|
bolt-modules/boltlib/spec/functions/run_command_spec.rb#L237
run_command with _env_vars transforms values to json
Failure/Error:
is_expected.to run
.with_params(command, targets, { '_env_vars' => env_vars })
expected run_command("echo $FRUIT", ["localhost"], {"_env_vars"=>{"FRUIT"=>{"apple"=>"banana"}}}) to have run successfully instead of Mocha::ExpectationError(unexpected invocation: #<Bolt::Executor:0x11b20>.run_command(["localhost"], "echo \\$FRUIT", {:env_vars => {"FRUIT" => "{\"apple\":\"banana\"}"}}, [])
unsatisfied expectations:
- expected exactly once, not yet invoked: #<Bolt::Executor:0x11b20>.run_command(["localhost"], "echo $FRUIT", {:env_vars => {"FRUIT" => "{\"apple\":\"banana\"}"}}, [])
satisfied expectations:
- expected exactly once, invoked once: #<Mock:inventory>.get_targets(["localhost"])
- allowed any number of times, invoked once: #<Mock:inventory>.target_implementation_class(any_parameters)
- allowed any number of times, not yet invoked: #<Mock:inventory>.version(any_parameters)
- allowed any number of times, not yet invoked: #<Puppet::Util::Feature:0x62c0>.root?(any_parameters)
)
D:/a/bolt/bolt/bolt-modules/boltlib/spec/fixtures/modules/boltlib/lib/puppet/functions/run_command.rb:154:in `run_command_with_description'
D:/a/bolt/bolt/bolt-modules/boltlib/spec/fixtures/modules/boltlib/lib/puppet/functions/run_command.rb:66:in `run_command'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatch.rb:60:in `invoke'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:47:in `block in dispatch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:46:in `catch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/dispatcher.rb:46:in `dispatch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:43:in `block in call'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:42:in `catch'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/pops/functions/function.rb:42:in `call'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/example/function_example_group.rb:21:in `block in execute'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet/context.rb:62:in `override'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/puppet-7.32.1/lib/puppet.rb:289:in `override'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/example/function_example_group.rb:20:in `execute'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-puppet-4.0.2/lib/rspec-puppet/matchers/run.rb:12:in `matches?'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:51:in `block in handle_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:27:in `with_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/expectation_target.rb:65:in `to'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.13.1/lib/rspec/expectations/expectation_target.rb:101:in `to'
D:/a/bolt/bolt/bolt-modules/boltlib/spec/functions/run_command_spec.rb:248:in `block (3 levels) in <top (required)>'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:263:in `instance_exec'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:263:in `block in run'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
D:/a/bolt/bolt/vendor/bundle/ruby/3.1.0/gems/rspec-co
|
|
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
The following actions uses Node.js version which is deprecated and will be forced to run on node20: actions/checkout@v2. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
This job failed
Loading