├── spec ├── fixtures │ ├── hiera │ │ ├── empty.yaml │ │ ├── data │ │ │ ├── hierarchy.yaml │ │ │ ├── var.yaml │ │ │ ├── os │ │ │ │ └── Ubuntu.yaml │ │ │ ├── plan_hierarchy.yaml │ │ │ ├── custom.txt │ │ │ ├── plan_var.yaml │ │ │ ├── nodes │ │ │ │ └── puppet_7_node.yaml │ │ │ ├── common.yaml │ │ │ └── secret.eyaml │ │ ├── bolt-project.yaml │ │ ├── plan_hiera_var.yaml │ │ ├── modules │ │ │ └── test │ │ │ │ ├── plans │ │ │ │ ├── lookup.pp │ │ │ │ ├── lookup_lambda.pp │ │ │ │ └── plan_lookup.pp │ │ │ │ ├── hiera.yaml │ │ │ │ └── data │ │ │ │ └── common.yaml │ │ ├── hiera_plan_var.yaml │ │ ├── plan_hiera.yaml │ │ ├── plan_hiera_facts.yaml │ │ ├── hiera_missing_backend.yaml │ │ ├── hiera_interpolations.yaml │ │ └── hiera.yaml │ ├── bolt_spec │ │ └── plans │ │ │ ├── files │ │ │ ├── script │ │ │ └── dir │ │ │ │ └── prep │ │ │ ├── tasks │ │ │ ├── foo │ │ │ └── prep │ │ │ └── plans │ │ │ ├── yaml.yaml │ │ │ ├── init.pp │ │ │ ├── plan_fails.pp │ │ │ ├── apply_prep.pp │ │ │ ├── plan_with_targets.pp │ │ │ ├── plan_calling_plan.pp │ │ │ ├── command.pp │ │ │ ├── out_message.pp │ │ │ ├── out_verbose.pp │ │ │ ├── plan_calling_targets.pp │ │ │ ├── get_resources.pp │ │ │ ├── upload.pp │ │ │ ├── download.pp │ │ │ ├── script.pp │ │ │ ├── apply.pp │ │ │ └── task.pp │ ├── inventory │ │ ├── empty.yaml │ │ ├── apply.yaml │ │ ├── invalid.yaml │ │ └── docker.yaml │ ├── configs │ │ ├── empty │ │ │ └── bolt-project.yaml │ │ └── invalid │ │ │ └── bolt-project.yaml │ ├── modules │ │ ├── plugin │ │ │ ├── bolt_plugin.json │ │ │ └── tasks │ │ │ │ ├── resolve_reference.sh │ │ │ │ └── resolve_reference.json │ │ ├── results │ │ │ ├── tasks │ │ │ │ ├── win.ps1 │ │ │ │ └── init.sh │ │ │ ├── plans │ │ │ │ ├── test_result.pp │ │ │ │ ├── test_error.pp │ │ │ │ ├── test_target.pp │ │ │ │ └── test_printing.pp │ │ │ └── lib │ │ │ │ └── puppet │ │ │ │ └── functions │ │ │ │ └── results │ │ │ │ ├── make_result.rb │ │ │ │ ├── make_apply_result.rb │ │ │ │ └── make_result_set.rb │ │ ├── sample │ │ │ ├── tasks │ │ │ │ ├── python.json │ │ │ │ ├── sleep.ps1 │ │ │ │ ├── notice.pp │ │ │ │ ├── invalid.sh │ │ │ │ ├── params.sh │ │ │ │ ├── sleep.sh │ │ │ │ ├── success.ps1 │ │ │ │ ├── init.sh │ │ │ │ ├── stdin.sh │ │ │ │ ├── success.sh │ │ │ │ ├── wininput.ps1 │ │ │ │ ├── winenv.ps1 │ │ │ │ ├── stdin.json │ │ │ │ ├── wininput.json │ │ │ │ ├── winparams.json │ │ │ │ ├── winstdin.json │ │ │ │ ├── winenv.json │ │ │ │ ├── multiline.ps1 │ │ │ │ ├── noop.sh │ │ │ │ ├── multiline.sh │ │ │ │ ├── ps_noop.ps1 │ │ │ │ ├── echo.sh │ │ │ │ ├── winstdin.ps1 │ │ │ │ ├── no_noop.sh │ │ │ │ ├── noop.json │ │ │ │ ├── no_noop.json │ │ │ │ ├── ps_noop.json │ │ │ │ ├── python.py │ │ │ │ ├── winparams.ps1 │ │ │ │ ├── bolt_ruby.rb │ │ │ │ ├── sensitive_task_output.sh │ │ │ │ ├── multiline.json │ │ │ │ ├── bolt_ruby.json │ │ │ │ ├── interpreter.json │ │ │ │ ├── sleep.json │ │ │ │ ├── invalid.json │ │ │ │ ├── success.json │ │ │ │ └── interpreter.py │ │ │ ├── scripts │ │ │ │ ├── script.py │ │ │ │ └── script.rb │ │ │ ├── plans │ │ │ │ ├── init.pp │ │ │ │ ├── download_file.pp │ │ │ │ ├── subdir │ │ │ │ │ └── command.pp │ │ │ │ ├── run_script.pp │ │ │ │ ├── noop.pp │ │ │ │ ├── successful_task.pp │ │ │ │ ├── failing_task.pp │ │ │ │ ├── targets_nodes.pp │ │ │ │ ├── documented_param_typo.pp │ │ │ │ ├── two_tasks.pp │ │ │ │ ├── single_task.pp │ │ │ │ ├── optional_params_task.pp │ │ │ │ ├── single_task_targets.pp │ │ │ │ ├── yaml.yaml │ │ │ │ └── three_tasks.pp │ │ │ └── metadata.json │ │ ├── upload_file │ │ │ └── files │ │ │ │ ├── subdir │ │ │ │ └── sub-file.sh │ │ │ │ └── test-file.sh │ │ ├── error │ │ │ ├── tasks │ │ │ │ ├── fail.ps1 │ │ │ │ ├── fail.sh │ │ │ │ ├── typed.ps1 │ │ │ │ ├── typed.sh │ │ │ │ ├── fail.json │ │ │ │ └── typed.json │ │ │ └── plans │ │ │ │ ├── inner.pp │ │ │ │ ├── outer.pp │ │ │ │ ├── args.pp │ │ │ │ ├── catch_plan.pp │ │ │ │ ├── err.pp │ │ │ │ ├── no_task.pp │ │ │ │ ├── run_fail.pp │ │ │ │ ├── call_run_fail.pp │ │ │ │ ├── nested.pp │ │ │ │ ├── catch_plan_run.pp │ │ │ │ └── winrm_disconnect.pp │ │ ├── identity │ │ │ └── tasks │ │ │ │ ├── linux.sh │ │ │ │ ├── win.ps1 │ │ │ │ └── init.json │ │ ├── remote │ │ │ └── tasks │ │ │ │ ├── init.json │ │ │ │ └── init.sh │ │ ├── env_var │ │ │ ├── tasks │ │ │ │ ├── ruby_env.ps1 │ │ │ │ ├── ruby_env.sh │ │ │ │ ├── get_var.sh │ │ │ │ └── ruby_env.json │ │ │ ├── plans │ │ │ │ ├── get_var.pp │ │ │ │ └── command.pp │ │ │ └── lib │ │ │ │ └── puppet │ │ │ │ └── functions │ │ │ │ └── env_var │ │ │ │ └── get_var.rb │ │ ├── private │ │ │ ├── tasks │ │ │ │ ├── init.sh │ │ │ │ └── init.json │ │ │ └── plans │ │ │ │ ├── api.pp │ │ │ │ ├── conflict.pp │ │ │ │ ├── yaml.yaml │ │ │ │ └── puppet.pp │ │ ├── yaml │ │ │ ├── files │ │ │ │ └── test.sh │ │ │ └── plans │ │ │ │ ├── undefined_var.yaml │ │ │ │ ├── define_foo.yaml │ │ │ │ ├── plan_isolated_from_subplan.yaml │ │ │ │ ├── duplicate_names.yaml │ │ │ │ ├── eval_error_bare_string.yaml │ │ │ │ ├── eval_error_sub_plan.yaml │ │ │ │ ├── bad_puppet.yaml │ │ │ │ ├── eval_error_scalar_literal.yaml │ │ │ │ ├── private.yaml │ │ │ │ ├── command.yml │ │ │ │ ├── plan_with_isolated_subplan.yaml │ │ │ │ ├── command.yaml │ │ │ │ ├── target_param.yaml │ │ │ │ ├── delegate.yaml │ │ │ │ ├── subdir │ │ │ │ └── init.yaml │ │ │ │ ├── verbose.yaml │ │ │ │ ├── target_preference.yaml │ │ │ │ ├── task.yaml │ │ │ │ ├── script.yaml │ │ │ │ ├── empty_resources.yaml │ │ │ │ ├── resources.yaml │ │ │ │ ├── download.yaml │ │ │ │ ├── upload.yaml │ │ │ │ ├── invalid.yaml │ │ │ │ ├── param_passing.yaml │ │ │ │ ├── resource_failure.yaml │ │ │ │ ├── complex_parameters.yaml │ │ │ │ └── to_code.yaml │ │ ├── parsing │ │ │ ├── tasks │ │ │ │ ├── init.pp │ │ │ │ └── init.json │ │ │ └── plans │ │ │ │ └── init.pp │ │ ├── task_param │ │ │ └── tasks │ │ │ │ ├── init.sh │ │ │ │ ├── win.json │ │ │ │ └── win.ps1 │ │ ├── output │ │ │ └── plans │ │ │ │ ├── init.pp │ │ │ │ ├── verbose.pp │ │ │ │ └── error.pp │ │ ├── logging │ │ │ ├── tasks │ │ │ │ └── echo.sh │ │ │ └── plans │ │ │ │ └── without_default.pp │ │ ├── with_both │ │ │ ├── scripts │ │ │ │ └── filepath.rb │ │ │ └── files │ │ │ │ └── scripts │ │ │ │ └── filepath.rb │ │ ├── with_files │ │ │ └── files │ │ │ │ ├── filepath.rb │ │ │ │ ├── toplevel.rb │ │ │ │ └── files │ │ │ │ └── filepath.rb │ │ ├── with_scripts │ │ │ └── scripts │ │ │ │ └── filepath.rb │ │ ├── container │ │ │ └── plans │ │ │ │ ├── init.pp │ │ │ │ ├── apply.pp │ │ │ │ ├── volume.pp │ │ │ │ └── parallel.pp │ │ ├── inventory │ │ │ └── plans │ │ │ │ ├── init.pp │ │ │ │ ├── get_host.pp │ │ │ │ └── transport.pp │ │ ├── vars │ │ │ └── plans │ │ │ │ ├── emit.pp │ │ │ │ └── init.pp │ │ ├── resource_types │ │ │ ├── lib │ │ │ │ └── puppet │ │ │ │ │ ├── type │ │ │ │ │ └── my_type.rb │ │ │ │ │ └── provider │ │ │ │ │ └── my_type │ │ │ │ │ └── my_type.rb │ │ │ └── plans │ │ │ │ └── init.pp │ │ ├── add_group │ │ │ └── plans │ │ │ │ ├── x_fail_group_name_exists.pp │ │ │ │ └── x_fail_non_existent_group.pp │ │ ├── facts_test │ │ │ └── plans │ │ │ │ ├── emit.pp │ │ │ │ └── init.pp │ │ ├── write_file │ │ │ └── plans │ │ │ │ └── init.pp │ │ ├── shareable │ │ │ └── tasks │ │ │ │ ├── invalid_path.json │ │ │ │ ├── not_a_file.json │ │ │ │ ├── unknown_file.json │ │ │ │ ├── unknown_module.json │ │ │ │ ├── not_a_directory.json │ │ │ │ ├── list.sh │ │ │ │ ├── list.ps1 │ │ │ │ └── init.json │ │ ├── analytics │ │ │ └── plans │ │ │ │ └── init.pp │ │ ├── resource │ │ │ └── plans │ │ │ │ └── init.pp │ │ ├── catch_errors │ │ │ └── plans │ │ │ │ ├── return.pp │ │ │ │ ├── break.pp │ │ │ │ ├── init.pp │ │ │ │ └── typed.pp │ │ ├── logs │ │ │ └── plans │ │ │ │ └── init.pp │ │ └── resources │ │ │ └── plans │ │ │ └── add_event.pp │ ├── plugin_modules │ │ ├── identity │ │ │ ├── bolt_plugin.json │ │ │ └── tasks │ │ │ │ ├── linux.sh │ │ │ │ ├── resolve_reference.sh │ │ │ │ ├── win.ps1 │ │ │ │ ├── value.sh │ │ │ │ ├── resolve_reference.ps1 │ │ │ │ ├── value.ps1 │ │ │ │ ├── init.json │ │ │ │ ├── value.json │ │ │ │ └── resolve_reference.json │ │ ├── empty_plug │ │ │ └── bolt_plugin.json │ │ ├── task_conf_plug │ │ │ ├── tasks │ │ │ │ ├── value.sh │ │ │ │ ├── linux.sh │ │ │ │ ├── value.json │ │ │ │ ├── win.ps1 │ │ │ │ └── init.json │ │ │ └── bolt_plugin.json │ │ ├── error_plugin │ │ │ ├── tasks │ │ │ │ ├── init.ps1 │ │ │ │ ├── init.sh │ │ │ │ └── init.json │ │ │ └── bolt_plugin.json │ │ ├── conf_plug │ │ │ ├── tasks │ │ │ │ ├── linux.sh │ │ │ │ ├── win.ps1 │ │ │ │ └── init.json │ │ │ └── bolt_plugin.json │ │ ├── my_plug │ │ │ ├── tasks │ │ │ │ ├── resolve_reference.sh │ │ │ │ └── resolve_reference.json │ │ │ └── bolt_plugin.json │ │ ├── no_plug │ │ │ └── tasks │ │ │ │ └── resolve_reference.sh │ │ ├── inv_plans │ │ │ └── plans │ │ │ │ └── puppet_library.pp │ │ ├── bad_result │ │ │ └── bolt_plugin.json │ │ └── my_secret │ │ │ └── bolt_plugin.json │ ├── projects │ │ ├── local │ │ │ ├── bolt-project.yaml │ │ │ ├── modules │ │ │ │ └── helpers │ │ │ │ │ └── files │ │ │ │ │ └── marco.sh │ │ │ ├── tasks │ │ │ │ ├── init.sh │ │ │ │ └── init.json │ │ │ └── plans │ │ │ │ └── init.pp │ │ ├── named │ │ │ ├── bolt-project.yaml │ │ │ ├── manifests │ │ │ │ └── notify.pp │ │ │ ├── modules │ │ │ │ └── test_project │ │ │ │ │ └── plans │ │ │ │ │ └── init.pp │ │ │ └── plans │ │ │ │ ├── init.pp │ │ │ │ └── apply.pp │ │ └── embedded │ │ │ └── Boltdir │ │ │ ├── bolt-project.yaml │ │ │ └── plans │ │ │ └── init.pp │ ├── run_as │ │ └── test │ │ │ ├── files │ │ │ ├── whoami.sh │ │ │ └── id.sh │ │ │ ├── tasks │ │ │ └── id.sh │ │ │ └── plans │ │ │ ├── whoami.pp │ │ │ ├── incept.pp │ │ │ ├── except.pp │ │ │ ├── run_as_user.pp │ │ │ └── id.pp │ ├── apply │ │ ├── data │ │ │ ├── common.yaml │ │ │ └── secure.eyaml │ │ ├── prep │ │ │ ├── tasks │ │ │ │ └── error.sh │ │ │ └── plans │ │ │ │ ├── version.pp │ │ │ │ ├── init.pp │ │ │ │ └── run_as.pp │ │ ├── basic │ │ │ ├── facts.d │ │ │ │ └── another.json │ │ │ ├── manifests │ │ │ │ ├── init.pp │ │ │ │ ├── strict.pp │ │ │ │ ├── strict_variables.pp │ │ │ │ └── exported_resources.pp │ │ │ ├── plans │ │ │ │ ├── class.pp │ │ │ │ ├── type.pp │ │ │ │ ├── resources.pp │ │ │ │ ├── disabled.pp │ │ │ │ ├── notify.pp │ │ │ │ ├── trusted.pp │ │ │ │ ├── failure.pp │ │ │ │ ├── hiera_lookup.pp │ │ │ │ ├── run_as_apply.pp │ │ │ │ ├── exported_resources.pp │ │ │ │ ├── xfail_set_var.pp │ │ │ │ ├── pdb_fact.pp │ │ │ │ ├── xfail_set_feature.pp │ │ │ │ ├── node_default.pp │ │ │ │ ├── pdb_query.pp │ │ │ │ ├── whoami.pp │ │ │ │ ├── catch_error.pp │ │ │ │ ├── target_vars.pp │ │ │ │ ├── defer.pp │ │ │ │ ├── error.pp │ │ │ │ ├── strict.pp │ │ │ │ ├── node_definition.pp │ │ │ │ ├── strict_variables.pp │ │ │ │ ├── project_files.pp │ │ │ │ ├── fact_merge.pp │ │ │ │ ├── collisions.pp │ │ │ │ ├── init.pp │ │ │ │ └── plan_vars.pp │ │ │ ├── lib │ │ │ │ ├── facter │ │ │ │ │ └── myfact.rb │ │ │ │ ├── puppet │ │ │ │ │ ├── feature │ │ │ │ │ │ └── can_warn.rb │ │ │ │ │ ├── functions │ │ │ │ │ │ ├── pid.rb │ │ │ │ │ │ └── load_error.rb │ │ │ │ │ ├── provider │ │ │ │ │ │ └── warn │ │ │ │ │ │ │ └── basic.rb │ │ │ │ │ └── type │ │ │ │ │ │ └── warn.rb │ │ │ │ └── puppet_x │ │ │ │ │ └── util │ │ │ │ │ └── warn.rb │ │ │ ├── metadata.json │ │ │ └── tasks │ │ │ │ └── ruby_task.rb │ │ ├── hiera_datadir │ │ │ └── common.yaml │ │ ├── sensitive │ │ │ └── tasks │ │ │ │ └── init.sh │ │ ├── hiera.yaml │ │ ├── apply_catalog.sh │ │ ├── device_test │ │ │ ├── plans │ │ │ │ ├── resources.pp │ │ │ │ ├── facts.pp │ │ │ │ └── set_a_val.pp │ │ │ └── lib │ │ │ │ └── puppet │ │ │ │ └── transport │ │ │ │ └── schema │ │ │ │ └── fake.rb │ │ ├── hiera_datadir.yaml │ │ ├── hiera_invalid.yaml │ │ ├── puppet_types │ │ │ └── plans │ │ │ │ ├── target_new.pp │ │ │ │ ├── target.pp │ │ │ │ ├── get_target.pp │ │ │ │ ├── get_targets.pp │ │ │ │ ├── resultset.pp │ │ │ │ ├── error.pp │ │ │ │ ├── sensitive_result.pp │ │ │ │ ├── result.pp │ │ │ │ └── applyresult.pp │ │ └── settings │ │ │ └── plans │ │ │ └── show_diff.pp │ ├── invalid_mods │ │ └── sample │ │ │ ├── tasks │ │ │ ├── ok.sh │ │ │ └── params.sh │ │ │ └── plans │ │ │ ├── ok.pp │ │ │ └── single_task.pp │ ├── api_server_configs │ │ ├── empty-bolt-server.conf │ │ ├── required-bolt-server.conf │ │ └── global-bolt-server.conf │ ├── parallel │ │ ├── error │ │ │ └── tasks │ │ │ │ ├── fail.ps1 │ │ │ │ ├── fail.sh │ │ │ │ └── fail.json │ │ ├── parallel │ │ │ ├── tasks │ │ │ │ ├── init.sh │ │ │ │ ├── init.ps1 │ │ │ │ └── init.json │ │ │ ├── functions │ │ │ │ └── custom_function.pp │ │ │ └── plans │ │ │ │ ├── init.pp │ │ │ │ ├── non_parallel.pp │ │ │ │ ├── hard_fail.pp │ │ │ │ ├── return.pp │ │ │ │ ├── catch_error_inner.pp │ │ │ │ ├── catch_error_outer.pp │ │ │ │ ├── error.pp │ │ │ │ └── custom_function.pp │ │ ├── wait │ │ │ └── plans │ │ │ │ ├── no_future │ │ │ │ ├── infinite_loop.pp │ │ │ │ ├── inner_bg.pp │ │ │ │ ├── multiple_calls.pp │ │ │ │ └── subplan.pp │ │ │ │ ├── inner_future.pp │ │ │ │ ├── timeout.pp │ │ │ │ └── error.pp │ │ └── background │ │ │ └── plans │ │ │ ├── return.pp │ │ │ ├── timing.pp │ │ │ ├── error.pp │ │ │ └── variables.pp │ ├── ssl │ │ ├── cert.pfx │ │ ├── ca.cfg │ │ ├── crl.pem │ │ └── v3.ext │ ├── bolt_server │ │ └── environments │ │ │ └── production │ │ │ └── modules │ │ │ └── bolt_server_test │ │ │ ├── tasks │ │ │ ├── init.sh │ │ │ ├── simple_task.sh │ │ │ ├── init.json │ │ │ └── simple_task.json │ │ │ └── plans │ │ │ ├── init.pp │ │ │ └── simple_plan.pp │ ├── scripts │ │ ├── trusted_external_facts.sh │ │ └── success.sh │ ├── puppetdb │ │ └── custom_source │ │ │ └── extensions.sql │ └── keys │ │ └── id_rsa.pub ├── lib │ └── bolt_spec │ │ ├── sensitive.rb │ │ ├── transport.rb │ │ ├── config.rb │ │ ├── errors.rb │ │ ├── env_var.rb │ │ └── event_collector.rb ├── unit │ ├── config │ │ └── transport │ │ │ └── options_spec.rb │ ├── module_installer │ │ └── puppetfile │ │ │ └── module_spec.rb │ └── module_spec.rb ├── Dockerfile.puppetdb └── bolt_spec │ └── plans │ └── mock_executor_spec.rb ├── .rspec ├── CODEOWNERS ├── bolt-modules ├── dir │ ├── spec │ │ ├── fixtures │ │ │ └── modules │ │ │ │ └── test │ │ │ │ └── facts.d │ │ │ │ ├── two.sh │ │ │ │ ├── .hidden │ │ │ │ └── fact.py │ │ └── spec_helper.rb │ └── Rakefile ├── boltlib │ ├── spec │ │ ├── fixtures │ │ │ └── modules │ │ │ │ ├── with_both │ │ │ │ ├── scripts │ │ │ │ │ └── hostname.sh │ │ │ │ └── files │ │ │ │ │ └── scripts │ │ │ │ │ └── hostname.sh │ │ │ │ ├── with_files │ │ │ │ └── files │ │ │ │ │ ├── hostname.sh │ │ │ │ │ ├── files │ │ │ │ │ └── hostname.sh │ │ │ │ │ └── toplevel.sh │ │ │ │ ├── test │ │ │ │ ├── tasks │ │ │ │ │ ├── yes.sh │ │ │ │ │ ├── echo.sh │ │ │ │ │ ├── init.sh │ │ │ │ │ ├── meta.sh │ │ │ │ │ ├── params.sh │ │ │ │ │ ├── undef.sh │ │ │ │ │ ├── sensitive_meta.sh │ │ │ │ │ ├── sensitive_type.sh │ │ │ │ │ ├── references.rb │ │ │ │ │ ├── meta.json │ │ │ │ │ ├── undef.json │ │ │ │ │ ├── sensitive_type.json │ │ │ │ │ └── sensitive_meta.json │ │ │ │ ├── plans │ │ │ │ │ ├── init.pp │ │ │ │ │ ├── run_me.pp │ │ │ │ │ ├── bad_return.pp │ │ │ │ │ ├── no_return.pp │ │ │ │ │ ├── run_me_int.pp │ │ │ │ │ ├── run_me_nodes.pp │ │ │ │ │ ├── run_me_targets.pp │ │ │ │ │ ├── run_me_nodes_and_targets.pp │ │ │ │ │ └── targetspec_params.pp │ │ │ │ ├── files │ │ │ │ │ └── uploads │ │ │ │ │ │ ├── hostname.sh │ │ │ │ │ │ └── index.html │ │ │ │ └── manifests │ │ │ │ │ └── init.pp │ │ │ │ ├── with_scripts │ │ │ │ └── scripts │ │ │ │ │ └── hostname.sh │ │ │ │ └── sensitive_test │ │ │ │ └── plans │ │ │ │ ├── no_api.pp │ │ │ │ ├── complex.pp │ │ │ │ └── init.pp │ │ └── spec_helper.rb │ ├── Rakefile │ └── types │ │ └── targetspec.pp ├── file │ ├── spec │ │ ├── fixtures │ │ │ └── modules │ │ │ │ ├── with_both │ │ │ │ ├── scripts │ │ │ │ │ └── filepath.sh │ │ │ │ └── files │ │ │ │ │ └── scripts │ │ │ │ │ └── filepath.sh │ │ │ │ ├── with_files │ │ │ │ └── files │ │ │ │ │ ├── filepath.sh │ │ │ │ │ ├── toplevel.sh │ │ │ │ │ └── files │ │ │ │ │ └── filepath.sh │ │ │ │ └── with_scripts │ │ │ │ └── scripts │ │ │ │ └── filepath.sh │ │ ├── spec_helper.rb │ │ └── functions │ │ │ └── file │ │ │ ├── write_spec.rb │ │ │ ├── delete_spec.rb │ │ │ └── join_spec.rb │ ├── Rakefile │ └── lib │ │ └── puppet │ │ └── functions │ │ └── file │ │ ├── join.rb │ │ └── delete.rb ├── ctrl │ ├── Rakefile │ ├── spec │ │ ├── spec_helper.rb │ │ └── functions │ │ │ └── ctrl │ │ │ └── sleep_spec.rb │ └── lib │ │ └── puppet │ │ └── functions │ │ └── ctrl │ │ └── sleep.rb ├── log │ ├── Rakefile │ └── spec │ │ └── spec_helper.rb ├── out │ ├── Rakefile │ └── spec │ │ └── spec_helper.rb ├── prompt │ ├── Rakefile │ └── spec │ │ └── spec_helper.rb └── system │ ├── Rakefile │ ├── spec │ ├── spec_helper.rb │ └── functions │ │ └── system │ │ └── env_spec.rb │ └── lib │ └── puppet │ └── functions │ └── system │ └── env.rb ├── acceptance ├── files │ └── example_apply │ │ ├── files │ │ └── motd │ │ ├── facts.d │ │ └── another.json │ │ ├── lib │ │ ├── facter │ │ │ └── myfact.rb │ │ ├── puppet │ │ │ ├── feature │ │ │ │ └── can_warn.rb │ │ │ ├── provider │ │ │ │ └── warn │ │ │ │ │ └── basic.rb │ │ │ └── type │ │ │ │ └── warn.rb │ │ └── puppet_x │ │ │ └── util │ │ │ └── warn.rb │ │ ├── metadata.json │ │ └── plans │ │ ├── puppet_status.pp │ │ └── init.pp ├── .gitignore ├── config │ ├── package │ │ └── options.rb │ ├── gem │ │ └── options.rb │ └── git │ │ └── options.rb └── setup │ └── common │ └── pre-suite │ └── 071_install_modules.rb ├── ext └── build_defaults.yaml ├── resources ├── bolt-logo.png ├── bolt-logo-dark.png └── bolt-logo-light.png ├── documentation ├── bolt_PS_2.png ├── bolt_PS_3.png ├── bolt-logo-dark.png ├── restart_service.png ├── plans.md └── tasks.md ├── bolt_spec_spec ├── Rakefile ├── functions │ └── with_datatype.pp └── spec │ ├── spec_helper.rb │ └── functions │ └── with_datatype_spec.rb ├── lib ├── bolt │ ├── version.rb │ ├── puppetdb.rb │ ├── transport │ │ ├── podman.rb │ │ ├── local.rb │ │ ├── jail.rb │ │ └── docker.rb │ ├── pal │ │ ├── logging.rb │ │ └── issues.rb │ ├── catalog │ │ └── logging.rb │ ├── config │ │ └── transport │ │ │ └── remote.rb │ ├── util │ │ └── puppet_log_level.rb │ └── module_installer │ │ └── puppetfile │ │ └── module.rb ├── bolt.rb ├── bolt_server │ ├── request_error.rb │ └── schemas │ │ ├── partials │ │ └── target-any.json │ │ ├── action-run_command.json │ │ ├── action-check_node_connections.json │ │ ├── transport-winrm.json │ │ └── transport-ssh.json └── logging_extensions │ └── logging.rb ├── modules ├── aggregate │ ├── Rakefile │ ├── spec │ │ ├── fixtures │ │ │ └── modules │ │ │ │ └── test_task │ │ │ │ └── tasks │ │ │ │ └── init.sh │ │ └── spec_helper.rb │ └── .fixtures.yml ├── canary │ ├── Rakefile │ ├── spec │ │ ├── fixtures │ │ │ └── modules │ │ │ │ └── test_task │ │ │ │ └── tasks │ │ │ │ └── init.pp │ │ ├── functions │ │ │ ├── random_split_spec.rb │ │ │ └── merge_spec.rb │ │ └── spec_helper.rb │ ├── .fixtures.yml │ └── lib │ │ └── puppet │ │ └── functions │ │ └── canary │ │ └── merge.rb ├── puppet_connect │ ├── Rakefile │ └── spec │ │ └── spec_helper.rb └── puppetdb_fact │ ├── Rakefile │ └── spec │ └── spec_helper.rb ├── .dockerignore ├── developer-docs ├── examples │ ├── bolt_spec_example │ │ └── tasks │ │ │ ├── init.rb │ │ │ └── init.json │ └── ssh-echo.json └── README.md ├── dev-resources ├── windows-kerberos │ ├── fixtures │ │ ├── samba-ad │ │ │ ├── docker-entrypoint.sh │ │ │ ├── krb5.osx.conf │ │ │ ├── krb5.conf.tmpl │ │ │ ├── supervisord.conf │ │ │ └── smb.conf.tmpl │ │ ├── omiserver │ │ │ ├── sssd.conf.tmpl │ │ │ └── realmd.conf.tmpl │ │ └── linuxdev │ │ │ └── docker-entrypoint.sh │ └── Dockerfile.samba-ad └── lxd │ ├── lxd_config.yaml │ └── README.md ├── .github ├── actions │ ├── windows_agentless_setup │ │ └── action.yaml │ ├── docker_setup │ │ └── action.yaml │ └── windows_agent_setup │ │ └── action.yaml ├── ISSUE_TEMPLATE │ ├── docs-change.md │ ├── bug-report.md │ └── feature-request.md └── workflows │ └── release-notes.yaml ├── config ├── local.conf └── docker.conf ├── docker-compose-bolt-server.yml ├── exe └── bolt ├── .rubocop.yml └── guides └── links.yaml /spec/fixtures/hiera/empty.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --require spec_helper 2 | --color -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/files/script: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/tasks/foo: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/tasks/prep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/inventory/empty.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/files/dir/prep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/configs/empty/bolt-project.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/modules/plugin/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/results/tasks/win.ps1: -------------------------------------------------------------------------------- 1 | exit 1 -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/python.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @puppetlabs/skeletor @puppetlabs/devx 2 | -------------------------------------------------------------------------------- /bolt-modules/dir/spec/fixtures/modules/test/facts.d/two.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/data/hierarchy.yaml: -------------------------------------------------------------------------------- 1 | pop: tarts 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/plugin/tasks/resolve_reference.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bolt-modules/dir/spec/fixtures/modules/test/facts.d/.hidden: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bolt-modules/dir/spec/fixtures/modules/test/facts.d/fact.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/data/var.yaml: -------------------------------------------------------------------------------- 1 | var: var data/var.yaml 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/sleep.ps1: -------------------------------------------------------------------------------- 1 | Start-Sleep -S 30 -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | { } 2 | -------------------------------------------------------------------------------- /spec/fixtures/projects/local/bolt-project.yaml: -------------------------------------------------------------------------------- 1 | name: local 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/notice.pp: -------------------------------------------------------------------------------- 1 | notice('hi') 2 | 3 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/empty_plug/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /spec/fixtures/run_as/test/files/whoami.sh: -------------------------------------------------------------------------------- 1 | #!bin/bash 2 | 3 | whoami -------------------------------------------------------------------------------- /acceptance/files/example_apply/files/motd: -------------------------------------------------------------------------------- 1 | Today's #WordOfTheDay is 'gloss' -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/with_both/scripts/hostname.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/with_files/files/hostname.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/apply/data/common.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | hiera_data: "default datadir" -------------------------------------------------------------------------------- /spec/fixtures/apply/prep/tasks/error.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 1 4 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/data/os/Ubuntu.yaml: -------------------------------------------------------------------------------- 1 | os: os data/os/Ubuntu.yaml 2 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/data/plan_hierarchy.yaml: -------------------------------------------------------------------------------- 1 | pop: goes the weasel 2 | -------------------------------------------------------------------------------- /spec/fixtures/invalid_mods/sample/tasks/ok.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/scripts/script.py: -------------------------------------------------------------------------------- 1 | print('Hello, world!') 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/invalid.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/params.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/sleep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sleep 30 -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/success.ps1: -------------------------------------------------------------------------------- 1 | Write-Output 'success' 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/upload_file/files/subdir/sub-file.sh: -------------------------------------------------------------------------------- 1 | Sub-content! -------------------------------------------------------------------------------- /spec/fixtures/projects/named/bolt-project.yaml: -------------------------------------------------------------------------------- 1 | name: test_project 2 | -------------------------------------------------------------------------------- /spec/fixtures/run_as/test/files/id.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | id -un 3 | -------------------------------------------------------------------------------- /spec/fixtures/run_as/test/tasks/id.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | id -un 3 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/yes.sh: -------------------------------------------------------------------------------- 1 | echo -n "yes" 2 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/with_both/files/scripts/hostname.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/with_files/files/files/hostname.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/with_scripts/scripts/hostname.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ext/build_defaults.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | build_gem: TRUE 3 | project: puppet-bolt 4 | -------------------------------------------------------------------------------- /spec/fixtures/api_server_configs/empty-bolt-server.conf: -------------------------------------------------------------------------------- 1 | bolt-server: { 2 | } -------------------------------------------------------------------------------- /spec/fixtures/hiera/data/custom.txt: -------------------------------------------------------------------------------- 1 | test::custom=test::custom data/custom.txt -------------------------------------------------------------------------------- /spec/fixtures/invalid_mods/sample/tasks/params.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 4 | -------------------------------------------------------------------------------- /spec/fixtures/inventory/apply.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | - uri: foo@example.com 3 | -------------------------------------------------------------------------------- /spec/fixtures/inventory/invalid.yaml: -------------------------------------------------------------------------------- 1 | this : isn't a : yaml file is it"? 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/tasks/fail.ps1: -------------------------------------------------------------------------------- 1 | Write-Output "failing" 2 | exit 1 -------------------------------------------------------------------------------- /spec/fixtures/modules/identity/tasks/linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cat 3 | -------------------------------------------------------------------------------- /spec/fixtures/modules/remote/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "remote": true 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/projects/embedded/Boltdir/bolt-project.yaml: -------------------------------------------------------------------------------- 1 | name: embedded 2 | -------------------------------------------------------------------------------- /acceptance/files/example_apply/facts.d/another.json: -------------------------------------------------------------------------------- 1 | { 2 | "another": "I'm" 3 | } -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/facts.d/another.json: -------------------------------------------------------------------------------- 1 | { 2 | "another": "I'm" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/apply/hiera_datadir/common.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | hiera_data: "custom datadir" -------------------------------------------------------------------------------- /spec/fixtures/hiera/data/plan_var.yaml: -------------------------------------------------------------------------------- 1 | plan_var: plan_var data/plan_var.yaml 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/env_var/tasks/ruby_env.ps1: -------------------------------------------------------------------------------- 1 | Write-Output $env:GEM_HOME 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/private/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "private" 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/remote/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cat 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo $PT_message 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/stdin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | grep "message" 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/success.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo 'success' 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/wininput.ps1: -------------------------------------------------------------------------------- 1 | Write-Output "INPUT: $Input" 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/files/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo $@ 4 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/task_conf_plug/tasks/value.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/echo.sh: -------------------------------------------------------------------------------- 1 | echo -n "$PT_message" 2 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/init.sh: -------------------------------------------------------------------------------- 1 | echo -n "$PT_message" 2 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/meta.sh: -------------------------------------------------------------------------------- 1 | echo -n "$PT_message" 2 | -------------------------------------------------------------------------------- /spec/fixtures/configs/invalid/bolt-project.yaml: -------------------------------------------------------------------------------- 1 | this : isn't a : yaml file is it"? 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/env_var/tasks/ruby_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo $GEM_HOME 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/winenv.ps1: -------------------------------------------------------------------------------- 1 | Write-Output "ENV: ${env:PT_message}" 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/undefined_var.yaml: -------------------------------------------------------------------------------- 1 | steps: [] 2 | return: $message 3 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/error/tasks/fail.ps1: -------------------------------------------------------------------------------- 1 | Write-Output "failing" 2 | exit 1 3 | 4 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cat 3 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/params.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 4 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/yaml.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - message: I'm a YAML plan 3 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/bolt-project.yaml: -------------------------------------------------------------------------------- 1 | name: hiera 2 | log: 3 | bolt-debug.log: disable 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/parsing/tasks/init.pp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cat /dev/stdin 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/stdin.json: -------------------------------------------------------------------------------- 1 | { 2 | "input_method": "stdin" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/wininput.json: -------------------------------------------------------------------------------- 1 | { 2 | "input_method": "stdin" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/winparams.json: -------------------------------------------------------------------------------- 1 | { 2 | "supports_noop": true 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/winstdin.json: -------------------------------------------------------------------------------- 1 | { 2 | "input_method": "stdin" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/task_param/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo Running task $PT__task -------------------------------------------------------------------------------- /spec/fixtures/modules/task_param/tasks/win.json: -------------------------------------------------------------------------------- 1 | { 2 | "supports_noop": true 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/error_plugin/tasks/init.ps1: -------------------------------------------------------------------------------- 1 | Write-Output "failing" 2 | exit 1 -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan test() { return "worked4" } 2 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/undef.sh: -------------------------------------------------------------------------------- 1 | echo -n "$PT_undef_default" 2 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/with_files/files/toplevel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | hostname 3 | -------------------------------------------------------------------------------- /resources/bolt-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puppetlabs/bolt/main/resources/bolt-logo.png -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan plans() { 2 | notice('Hello world') 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/data/nodes/puppet_7_node.yaml: -------------------------------------------------------------------------------- 1 | certname: certname data/puppet_7_node.yaml 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/env_var/tasks/get_var.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo $test_var 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/winenv.json: -------------------------------------------------------------------------------- 1 | { 2 | "input_method": "environment" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/resolve_reference.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cat 3 | -------------------------------------------------------------------------------- /spec/fixtures/projects/local/modules/helpers/files/marco.sh: -------------------------------------------------------------------------------- 1 | marco () { 2 | echo "polo" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/projects/local/tasks/init.sh: -------------------------------------------------------------------------------- 1 | . $PT__installdir/helpers/files/marco.sh 2 | marco 3 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/files/uploads/hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | hostname 3 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/fixtures/modules/with_both/scripts/filepath.sh: -------------------------------------------------------------------------------- 1 | with_both/scripts/filepath.sh 2 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/fixtures/modules/with_files/files/filepath.sh: -------------------------------------------------------------------------------- 1 | with_files/files/filepath.sh 2 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/fixtures/modules/with_files/files/toplevel.sh: -------------------------------------------------------------------------------- 1 | with_files/files/toplevel.sh 2 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/manifests/init.pp: -------------------------------------------------------------------------------- 1 | class basic() { 2 | notify { 'hello world': } 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/tasks/fail.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "failing" 4 | exit 1 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan sample() { 2 | notice 'I am the init plan' 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/multiline.ps1: -------------------------------------------------------------------------------- 1 | Write-Output "In like a lion`nOut like a lamb" 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/noop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo $PT_message with noop $PT__noop 4 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/error/tasks/fail.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "failing" 4 | exit 1 5 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sleep $PT_time 4 | echo $PT_val 5 | -------------------------------------------------------------------------------- /spec/fixtures/ssl/cert.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puppetlabs/bolt/main/spec/fixtures/ssl/cert.pfx -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/plans/run_me.pp: -------------------------------------------------------------------------------- 1 | plan test::run_me() { return "worked2" } 2 | -------------------------------------------------------------------------------- /documentation/bolt_PS_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puppetlabs/bolt/main/documentation/bolt_PS_2.png -------------------------------------------------------------------------------- /documentation/bolt_PS_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puppetlabs/bolt/main/documentation/bolt_PS_3.png -------------------------------------------------------------------------------- /resources/bolt-logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puppetlabs/bolt/main/resources/bolt-logo-dark.png -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/inner.pp: -------------------------------------------------------------------------------- 1 | plan error::inner( 2 | ) { 3 | run_command('whoami') 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/identity/tasks/win.ps1: -------------------------------------------------------------------------------- 1 | $line = [Console]::In.ReadLine() 2 | Write-Output "$line" 3 | -------------------------------------------------------------------------------- /spec/fixtures/modules/plugin/tasks/resolve_reference.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "My custom plugin" 3 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/define_foo.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: foo 3 | eval: "hello world" 4 | -------------------------------------------------------------------------------- /bolt-modules/ctrl/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /bolt-modules/dir/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /bolt-modules/file/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/fixtures/modules/with_files/files/files/filepath.sh: -------------------------------------------------------------------------------- 1 | with_files/files/files/filepath.sh 2 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/fixtures/modules/with_scripts/scripts/filepath.sh: -------------------------------------------------------------------------------- 1 | with_scripts/scripts/filepath.sh 2 | -------------------------------------------------------------------------------- /bolt-modules/log/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /bolt-modules/out/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /bolt_spec_spec/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /lib/bolt/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Bolt 4 | VERSION = '4.0.1-rc.001' 5 | end 6 | -------------------------------------------------------------------------------- /modules/aggregate/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /modules/aggregate/spec/fixtures/modules/test_task/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # empty task for plan 3 | -------------------------------------------------------------------------------- /modules/canary/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /modules/canary/spec/fixtures/modules/test_task/tasks/init.pp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #empty task file 4 | -------------------------------------------------------------------------------- /resources/bolt-logo-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puppetlabs/bolt/main/resources/bolt-logo-light.png -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/outer.pp: -------------------------------------------------------------------------------- 1 | plan error::outer( 2 | ) { 3 | run_plan('error::inner') 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/output/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan output() { 2 | out::message("Outputting a message") 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/scripts/script.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | puts "Hello, world!" 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/multiline.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "In like a lion\nOut like a lamb" 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/ps_noop.ps1: -------------------------------------------------------------------------------- 1 | param ($message, $_noop) 2 | echo "$message with noop $_noop" 3 | -------------------------------------------------------------------------------- /spec/fixtures/modules/upload_file/files/test-file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 'hi!' 4 | echo $0 5 | echo $@ 6 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/tasks/init.ps1: -------------------------------------------------------------------------------- 1 | Start-Sleep -S ${env:PT_time} 2 | Write-Output "${env:PT_val}" 3 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/win.ps1: -------------------------------------------------------------------------------- 1 | $line = [Console]::In.ReadLine() 2 | Write-Output "$line" 3 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/fixtures/modules/with_both/files/scripts/filepath.sh: -------------------------------------------------------------------------------- 1 | with_both/files/scripts/filepath.sh 2 | -------------------------------------------------------------------------------- /bolt-modules/prompt/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /bolt-modules/system/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /documentation/bolt-logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puppetlabs/bolt/main/documentation/bolt-logo-dark.png -------------------------------------------------------------------------------- /documentation/restart_service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/puppetlabs/bolt/main/documentation/restart_service.png -------------------------------------------------------------------------------- /modules/puppet_connect/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /modules/puppetdb_fact/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppetlabs_spec_helper/rake_tasks' 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/output/plans/verbose.pp: -------------------------------------------------------------------------------- 1 | plan output::verbose() { 2 | out::verbose("Hi, I'm Dave") 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/echo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo $(hostname) got passed the message: $PT_message 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/winstdin.ps1: -------------------------------------------------------------------------------- 1 | $line = [Console]::In.ReadLine() 2 | Write-Output "STDIN: $line" 3 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/error_plugin/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "failing" 4 | exit 1 5 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/value.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo '{"value":' 3 | cat 4 | echo '}' 5 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .bundle/ 2 | .git/ 3 | # If we start shipping this we may reevaluate 4 | Gemfile.lock 5 | vendor/bundle 6 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/plans/bad_return.pp: -------------------------------------------------------------------------------- 1 | plan test::bad_return { 2 | return(/foo/) 3 | } 4 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/plans/no_return.pp: -------------------------------------------------------------------------------- 1 | plan test::no_return() { "this is not returned" } 2 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/plans/run_me_int.pp: -------------------------------------------------------------------------------- 1 | plan test::run_me_int(Integer $x) { return $x } 2 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_server/environments/production/modules/bolt_server_test/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | whoami -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/plan_fails.pp: -------------------------------------------------------------------------------- 1 | plan plans::plan_fails() { 2 | fail_plan('expected failure') 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/logging/tasks/echo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo $(hostname) got passed the message: $PT_message 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/no_noop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo $(hostname) got passed the message: $PT_message 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/noop.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Task with noop", 3 | "supports_noop": true 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/conf_plug/tasks/linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo '{"value":' 3 | cat 4 | echo '}' 5 | -------------------------------------------------------------------------------- /spec/fixtures/projects/named/manifests/notify.pp: -------------------------------------------------------------------------------- 1 | class test_project::notify { 2 | notify { "project notify": } 3 | } 4 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/files/uploads/index.html: -------------------------------------------------------------------------------- 1 | 2 |
Hello World 3 | 4 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_server/environments/production/modules/bolt_server_test/tasks/simple_task.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | whoami -------------------------------------------------------------------------------- /spec/fixtures/modules/private/plans/api.pp: -------------------------------------------------------------------------------- 1 | # A plan with a private api tag 2 | # @api private 3 | plan private::api() {} 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/plan_isolated_from_subplan.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - plan: yaml::define_foo 3 | 4 | return: $foo 5 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/resolve_reference.ps1: -------------------------------------------------------------------------------- 1 | $line = [Console]::In.ReadLine() 2 | Write-Output "$line" 3 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/my_plug/tasks/resolve_reference.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo '{"config": "string_val"}' 4 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/task_conf_plug/tasks/linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo '{"value":' 3 | cat 4 | echo '}' 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/args.pp: -------------------------------------------------------------------------------- 1 | plan error::args { 2 | fail_plan('oops', 'test/oops', { 'some' => 'info' }) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/no_noop.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Task with no noop", 3 | "supports_noop": false 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/no_plug/tasks/resolve_reference.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env/bash 2 | 3 | echo this should not be discovered 4 | -------------------------------------------------------------------------------- /spec/fixtures/run_as/test/plans/whoami.pp: -------------------------------------------------------------------------------- 1 | plan test::whoami(String $target) { 2 | return run_command('whoami', $target) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/scripts/trusted_external_facts.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "{\"hot\": \"cocoa\", \"pepper\": \"mint\"}" 4 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/plan_hiera_var.yaml: -------------------------------------------------------------------------------- 1 | version: 5 2 | 3 | plan_hierarchy: 4 | - name: Common 5 | path: "%{interpolate}.yaml" 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/ps_noop.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Powershell task with noop", 3 | "supports_noop": true 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/my_plug/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | { "hooks": {"secret_createkeys": { "task": "my_plug::resolve_reference" } } } 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/catch_plan.pp: -------------------------------------------------------------------------------- 1 | plan error::catch_plan { 2 | return run_plan('error::err', '_catch_errors' => true) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/err.pp: -------------------------------------------------------------------------------- 1 | plan error::err { 2 | fail_plan(Error('oops', 'test/oops', {'some' => 'info'}, undef)) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/python.py: -------------------------------------------------------------------------------- 1 | import json, sys 2 | result = { "message": "Hello, world!" } 3 | json.dump(result, sys.stdout) 4 | -------------------------------------------------------------------------------- /spec/fixtures/puppetdb/custom_source/extensions.sql: -------------------------------------------------------------------------------- 1 | CREATE EXTENSION IF NOT EXISTS pg_trgm; 2 | CREATE EXTENSION IF NOT EXISTS pgcrypto; 3 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/sensitive_test/plans/no_api.pp: -------------------------------------------------------------------------------- 1 | plan sensitive_test::no_api ( 2 | Sensitive[String] $string 3 | ) { 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/class.pp: -------------------------------------------------------------------------------- 1 | plan basic::class(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | include 'basic' 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/type.pp: -------------------------------------------------------------------------------- 1 | plan basic::type(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | warn { "Hello!": } 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/sensitive/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo '{"user": "someone", "_sensitive": { "password": "secretpassword" }}' 4 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_server/environments/production/modules/bolt_server_test/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Environment task testing" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/no_task.pp: -------------------------------------------------------------------------------- 1 | plan error::no_task( 2 | TargetSpec $targets 3 | ) { 4 | run_task("not::a_task", $targets) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/run_fail.pp: -------------------------------------------------------------------------------- 1 | plan error::run_fail( 2 | TargetSpec $targets 3 | ) { 4 | run_task('error::fail', $targets) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/tasks/typed.ps1: -------------------------------------------------------------------------------- 1 | If($env:PT_fail -eq 'true') { 2 | exit 1 3 | } Else { 4 | Write-Output "{`"tag`": `"you're it`"}" 5 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/output/plans/error.pp: -------------------------------------------------------------------------------- 1 | plan output::error () { 2 | out::message(Error.new('Something went horribly, horribly wrong')) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/private/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Private Task", 3 | "description": "Do not list this task", 4 | "private": true 5 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/duplicate_names.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: foo 3 | eval: "hello world" 4 | - name: foo 5 | eval: "Goodbye" 6 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/inv_plans/plans/puppet_library.pp: -------------------------------------------------------------------------------- 1 | plan inv_plans::puppet_library ( TargetSpec $nodes ) { 2 | apply_prep($nodes) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/run_as/test/plans/incept.pp: -------------------------------------------------------------------------------- 1 | plan test::incept( 2 | String $target 3 | ) { 4 | return run_plan(test::id, target => $target) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/manifests/strict.pp: -------------------------------------------------------------------------------- 1 | class basic::strict() { 2 | $hash = { a => 1, a => 2 } 3 | notify { 'hello': message => $hash } 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/resources.pp: -------------------------------------------------------------------------------- 1 | plan basic::resources(TargetSpec $nodes) { 2 | return $nodes.get_resources(['user', 'File[/tmp]']) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/apply_prep.pp: -------------------------------------------------------------------------------- 1 | plan plans::apply_prep(TargetSpec $nodes) { 2 | $nodes.apply_prep 3 | return $nodes.apply_prep 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/with_both/scripts/filepath.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | puts "Loaded from with_both/scripts/" 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/with_files/files/filepath.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | puts "Loaded from with_files/files/" 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/with_files/files/toplevel.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | puts "Loaded from with_files/files/" 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/eval_error_bare_string.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: value 3 | eval: $foo.map |$l| { $l * 2 } 4 | 5 | return: $value 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/eval_error_sub_plan.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: result 3 | plan: yaml::eval_error_bare_string 4 | 5 | return: $result 6 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/manifests/init.pp: -------------------------------------------------------------------------------- 1 | class test ? this is not valid puppet ? 2 | Part of the test "the call does not load init.pp" 3 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/lib/facter/myfact.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Facter.add(:myfact) do 4 | setcode { 5 | 'there' 6 | } 7 | end 8 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/manifests/strict_variables.pp: -------------------------------------------------------------------------------- 1 | class basic::strict_variables() { 2 | notify { 'hello': message => "hello ${some_var_name}" } 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/results/tasks/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ ! -z "$PT_fail" ]; then 4 | exit 1 5 | else 6 | echo "{\"tag\": \"you're it\"}" 7 | fi 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/with_scripts/scripts/filepath.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | puts "Loaded from with_scripts/scripts/" 5 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/bad_result/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "resolve_reference": { 4 | "task": "identity" 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /acceptance/files/example_apply/lib/facter/myfact.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Facter.add(:myfact) do 4 | setcode { 5 | 'there' 6 | } 7 | end 8 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/plans/run_me_nodes.pp: -------------------------------------------------------------------------------- 1 | plan test::run_me_nodes( 2 | BoltLib::TargetSpec $nodes, 3 | ) { 4 | return $nodes 5 | } 6 | -------------------------------------------------------------------------------- /developer-docs/examples/bolt_spec_example/tasks/init.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | File.write(ENV['PT_file'], ENV['PT_content']) 5 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/disabled.pp: -------------------------------------------------------------------------------- 1 | plan basic::disabled(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | run_task('foo', ['foo']) 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/notify.pp: -------------------------------------------------------------------------------- 1 | plan basic::notify(TargetSpec $nodes) { 2 | 3 | return apply($nodes) { 4 | notify { "Apply: Hi!": } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/apply/hiera.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: 5 | data_hash: yaml_data 6 | 7 | hierarchy: 8 | - name: "Common" 9 | path: "common.yaml" -------------------------------------------------------------------------------- /spec/fixtures/bolt_server/environments/production/modules/bolt_server_test/tasks/simple_task.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Environment task testing simple" 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/plan_with_targets.pp: -------------------------------------------------------------------------------- 1 | plan plans::plan_with_targets(TargetSpec $targets) { 2 | return run_command('hostname', $targets) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/modules/test/plans/lookup.pp: -------------------------------------------------------------------------------- 1 | plan test::lookup( 2 | String $key, 3 | Hash $options = {} 4 | ) { 5 | return lookup($key, $options) 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/modules/container/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan container( 2 | String $image = 'ubuntu:18.04' 3 | ) { 4 | return run_container($image, 'rm' => true) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/inventory/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan inventory( 2 | String $command, 3 | String $host, 4 | ) { 5 | return run_command($command, $host) 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/modules/with_both/files/scripts/filepath.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | puts "Loaded from with_both/files/scripts/" 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/with_files/files/files/filepath.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | puts "Loaded from with_files/files/files/" 5 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/conf_plug/tasks/win.ps1: -------------------------------------------------------------------------------- 1 | $line = [Console]::In.ReadLine() 2 | Write-Output '{"value": ' 3 | Write-Output "$line" 4 | Write-Output '}' 5 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/value.ps1: -------------------------------------------------------------------------------- 1 | $line = [Console]::In.ReadLine() 2 | Write-Output '{"value": ' 3 | Write-Output "$line" 4 | Write-Output '}' 5 | -------------------------------------------------------------------------------- /developer-docs/README.md: -------------------------------------------------------------------------------- 1 | # Developer Documentation 2 | 3 | Note: the [bolt-server apis](bolt-api-servers.md) are considered private and subject to change without notice. -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/trusted.pp: -------------------------------------------------------------------------------- 1 | plan basic::trusted(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | notify { "trusted ${trusted}": } 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/plan_calling_plan.pp: -------------------------------------------------------------------------------- 1 | plan plans::plan_calling_plan(TargetSpec $targets) { 2 | return run_plan('plans::command', $targets) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/tasks/typed.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ "$PT_fail" = true ]; then 4 | exit 1 5 | else 6 | echo "{\"tag\": \"you're it\"}" 7 | fi 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/private/plans/conflict.pp: -------------------------------------------------------------------------------- 1 | # A plan with conflicting api and private tags 2 | # @api private 3 | # @private false 4 | plan private::conflict() {} 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/vars/plans/emit.pp: -------------------------------------------------------------------------------- 1 | plan vars::emit(String $host) { 2 | $target = get_targets($host)[0] 3 | return "Vars for ${host}: ${$target.vars}" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/wait/plans/no_future/infinite_loop.pp: -------------------------------------------------------------------------------- 1 | plan wait::no_future::infinite_loop() { 2 | background("infinite loop") || { 3 | wait() 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/task_conf_plug/tasks/value.json: -------------------------------------------------------------------------------- 1 | { 2 | "parameters": { 3 | "intersection_key": { 4 | "type": "String" 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/task_conf_plug/tasks/win.ps1: -------------------------------------------------------------------------------- 1 | $line = [Console]::In.ReadLine() 2 | Write-Output '{"value": ' 3 | Write-Output "$line" 4 | Write-Output '}' 5 | -------------------------------------------------------------------------------- /spec/fixtures/projects/local/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "An example task that uses the ruby helper library", 3 | "files": ["helpers/files/marco.sh"] 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/run_as/test/plans/except.pp: -------------------------------------------------------------------------------- 1 | plan test::except( 2 | String $target 3 | ) { 4 | return run_plan(test::id, target => $target, _run_as => 'root') 5 | } 6 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/plans/run_me_targets.pp: -------------------------------------------------------------------------------- 1 | plan test::run_me_targets( 2 | BoltLib::TargetSpec $targets, 3 | ) { 4 | return $targets 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/apply_catalog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo '{"metrics": {}, "resource_statuses": {}, "status": "unchanged", "catalog":' 4 | printenv PT_catalog 5 | echo '}' 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/lib/puppet/feature/can_warn.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet/util/feature' 4 | 5 | Puppet.features.add(:can_warn) { true } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/failure.pp: -------------------------------------------------------------------------------- 1 | plan basic::failure (TargetSpec $nodes) { 2 | return apply($nodes) { 3 | package {'nonexistentpackagename': } 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/device_test/plans/resources.pp: -------------------------------------------------------------------------------- 1 | plan device_test::resources( 2 | $nodes 3 | ) { 4 | $r = get_resources($nodes, 'Fake_device') 5 | return $r 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/apply/prep/plans/version.pp: -------------------------------------------------------------------------------- 1 | plan prep::version(TargetSpec $nodes) { 2 | $nodes.apply_prep 3 | 4 | return run_task("puppet_agent::version", $nodes) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_server/environments/production/modules/bolt_server_test/plans/init.pp: -------------------------------------------------------------------------------- 1 | # Init plan testing 2 | plan bolt_server_test(String $bar) { 3 | return $bar 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/call_run_fail.pp: -------------------------------------------------------------------------------- 1 | plan error::call_run_fail ( 2 | TargetSpec $targets 3 | ) { 4 | run_plan('error::run_fail', 'target' => $target) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/nested.pp: -------------------------------------------------------------------------------- 1 | plan error::nested { 2 | $err = run_plan('error::err', '_catch_errors' => true); 3 | return({ 'error' => [ $err ] }) 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/inventory/plans/get_host.pp: -------------------------------------------------------------------------------- 1 | plan inventory::get_host($nodes ) { 2 | $target = get_targets($nodes)[0] 3 | return({ 'result' => $target.host}) 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/resource_types/lib/puppet/type/my_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Puppet::Type.newtype(:my_type) do 4 | @doc = "Empty type" 5 | end 6 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/functions/custom_function.pp: -------------------------------------------------------------------------------- 1 | function parallel::custom_function ( 2 | TargetSpec $target 3 | ) { 4 | run_command('whoami', $target) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/scripts/success.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | for var in "$@" 3 | do 4 | echo "arg: $var" 5 | done 6 | 7 | echo "standard out" 8 | echo "standard error" >&2 9 | -------------------------------------------------------------------------------- /acceptance/files/example_apply/lib/puppet/feature/can_warn.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet/util/feature' 4 | 5 | Puppet.features.add(:can_warn) { true } 6 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/sensitive_test/plans/complex.pp: -------------------------------------------------------------------------------- 1 | plan sensitive_test::complex ( 2 | Variant[Sensitive[String], Array[String]] $complex 3 | ) { 4 | } 5 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/sensitive_meta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "$PT_sensitive_string" 4 | echo "$PT_sensitive_array" 5 | echo "$PT_sensitive_hash" 6 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/sensitive_type.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "$PT_sensitive_string" 4 | echo "$PT_sensitive_array" 5 | echo "$PT_sensitive_hash" 6 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/command.pp: -------------------------------------------------------------------------------- 1 | plan plans::command(TargetSpec $nodes) { 2 | run_command('hostname', $nodes) 3 | return run_command('echo hello', $nodes) 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/add_group/plans/x_fail_group_name_exists.pp: -------------------------------------------------------------------------------- 1 | plan add_group::x_fail_group_name_exists (TargetSpec $nodes) { 2 | add_to_group(Target.new('foo'), 'foo') 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/download_file.pp: -------------------------------------------------------------------------------- 1 | plan sample::download_file( 2 | TargetSpec $nodes, 3 | ) { 4 | return download_file('/etc/hosts', 'subdir', $nodes) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/subdir/command.pp: -------------------------------------------------------------------------------- 1 | plan sample::subdir::command ( 2 | TargetSpec $targets 3 | ) { 4 | return run_command('echo From subdir', $targets) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/background/plans/return.pp: -------------------------------------------------------------------------------- 1 | plan background::return() { 2 | $future = background() || { 3 | return 'Return me!' 4 | } 5 | return $future.wait 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "author": "Anyone, really.", 4 | "license": "Apache-2.0", 5 | "source": "", 6 | "dependencies": [] 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/hiera_lookup.pp: -------------------------------------------------------------------------------- 1 | plan basic::hiera_lookup(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | notify { "hello ${lookup('hiera_data')}": } 4 | } 5 | } -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/out_message.pp: -------------------------------------------------------------------------------- 1 | plan plans::out_message(Array[String] $messages) { 2 | $messages.each |$message| { 3 | out::message($message) 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/out_verbose.pp: -------------------------------------------------------------------------------- 1 | plan plans::out_verbose(Array[String] $messages) { 2 | $messages.each |$message| { 3 | out::verbose($message) 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/plan_calling_targets.pp: -------------------------------------------------------------------------------- 1 | plan plans::plan_calling_targets(TargetSpec $targets) { 2 | return run_plan('plans::plan_with_targets', $targets) 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/add_group/plans/x_fail_non_existent_group.pp: -------------------------------------------------------------------------------- 1 | plan add_group::x_fail_non_existent_group (TargetSpec $nodes) { 2 | add_to_group('foo', 'does_not_exist') 3 | } 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/facts_test/plans/emit.pp: -------------------------------------------------------------------------------- 1 | plan facts_test::emit(String $host) { 2 | $target = get_targets($host)[0] 3 | return "Facts for ${host}: ${facts($target)}" 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/run_script.pp: -------------------------------------------------------------------------------- 1 | plan sample::run_script( 2 | TargetSpec $targets, 3 | String[1] $script 4 | ) { 5 | return run_script($script, $targets) 6 | } 7 | -------------------------------------------------------------------------------- /acceptance/.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | .bundle 3 | Gemfile.lock 4 | local_options.rb 5 | log 6 | junit 7 | id_rsa-acceptance 8 | id_rsa-acceptance.pub 9 | merged_options.rb 10 | tmp 11 | -------------------------------------------------------------------------------- /acceptance/files/example_apply/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "author": "Anyone, really.", 4 | "license": "Apache-2.0", 5 | "source": "", 6 | "dependencies": [] 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/modules/test/hiera.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: 5 | data_hash: yaml_data 6 | 7 | hierarchy: 8 | - name: common 9 | path: common.yaml 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/noop.pp: -------------------------------------------------------------------------------- 1 | plan sample::noop ( 2 | TargetSpec $nodes 3 | ) { 4 | return run_task('sample::noop', $nodes, message => 'This works', _noop => true) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/successful_task.pp: -------------------------------------------------------------------------------- 1 | plan sample::successful_task ( 2 | TargetSpec $targets = 'localhost' 3 | ) { 4 | return run_task('sample::success', $targets) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/winparams.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param( 3 | [Parameter(Mandatory = $True)] 4 | [string] 5 | $Message 6 | ) 7 | 8 | Write-Output "Message: $Message" -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/bad_puppet.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: x_fail 3 | task: sample 4 | targets: 'foo' 5 | parameters: 6 | message: | 7 | def not_puppet 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/eval_error_scalar_literal.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: value 3 | eval: | 4 | $foo = 'foo' 5 | $foo.map |$l| { $l * 2 } 6 | 7 | return: $value 8 | -------------------------------------------------------------------------------- /spec/fixtures/projects/named/modules/test_project/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan test_project( 2 | TargetSpec $targets 3 | ) { 4 | fail_plan("This plan should be shadowed by the project") 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/lib/puppet/functions/pid.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Puppet::Functions.create_function(:pid) do 4 | def pid 5 | Process.pid.to_s 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/run_as_apply.pp: -------------------------------------------------------------------------------- 1 | plan basic::run_as_apply( 2 | TargetSpec $nodes, 3 | String $user 4 | ) { 5 | return run_plan(basic::whoami, $nodes, _run_as => $user) 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/modules/inventory/plans/transport.pp: -------------------------------------------------------------------------------- 1 | plan inventory::transport ( 2 | TargetSpec $targets 3 | ) { 4 | $target = get_target($targets) 5 | return $target.transport.chomp 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/modules/task_param/tasks/win.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param( 3 | [Parameter(Mandatory = $False)] 4 | [String] 5 | $_task 6 | ) 7 | 8 | Write-Output "Running task $_task" 9 | -------------------------------------------------------------------------------- /bolt_spec_spec/functions/with_datatype.pp: -------------------------------------------------------------------------------- 1 | function bolt_spec_spec::with_datatype ( 2 | Boltlib::TargetSpec $target 3 | ) { 4 | out::message("Loaded TargetSpec ${$target}") 5 | $target 6 | } 7 | -------------------------------------------------------------------------------- /dev-resources/windows-kerberos/fixtures/samba-ad/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./samba-ad-config.sh 4 | ./kerberos-client-config.sh 5 | 6 | /usr/bin/supervisord -c /etc/supervisord.conf 7 | -------------------------------------------------------------------------------- /modules/canary/.fixtures.yml: -------------------------------------------------------------------------------- 1 | --- 2 | fixtures: 3 | symlinks: 4 | canary: "#{source_dir}" 5 | boltlib: "#{File.absolute_path(File.join(source_dir, '..', '..', 'bolt-modules', 'boltlib'))}" 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/manifests/exported_resources.pp: -------------------------------------------------------------------------------- 1 | class basic::exported_resources() { 2 | @@file { 'helloworld.txt': 3 | content => 'hello world', 4 | } 5 | 6 | File <<| |>> 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_server/environments/production/modules/bolt_server_test/plans/simple_plan.pp: -------------------------------------------------------------------------------- 1 | # Simple plan testing 2 | plan bolt_server_test::simple_plan(String $foo) { 3 | return $foo 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/get_resources.pp: -------------------------------------------------------------------------------- 1 | plan plans::get_resources(TargetSpec $nodes) { 2 | $nodes.get_resources('User') 3 | return $nodes.get_resources(['user', 'File[/tmp]']) 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/vars/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan vars(String $host) { 2 | $target = get_targets($host)[0] 3 | $target.set_var('bugs', 'bunny') 4 | return "Vars for ${host}: ${$target.vars}" 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/my_secret/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | { "hooks": { 2 | "secret_encrypt": { "task": "identity::value" }, 3 | "secret_decrypt": { "task": "identity::value" } 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/projects/local/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan local( 2 | TargetSpec $targets 3 | ) { 4 | $target_object = get_target($targets) 5 | return run_command("echo polo", $target_object) 6 | } 7 | 8 | -------------------------------------------------------------------------------- /modules/aggregate/.fixtures.yml: -------------------------------------------------------------------------------- 1 | --- 2 | fixtures: 3 | symlinks: 4 | aggregate: "#{source_dir}" 5 | boltlib: "#{File.absolute_path(File.join(source_dir, '..', '..', 'bolt-modules', 'boltlib'))}" 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/exported_resources.pp: -------------------------------------------------------------------------------- 1 | plan basic::exported_resources ( 2 | TargetSpec $targets 3 | ) { 4 | apply($targets) { 5 | include 'basic::exported_resources' 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/xfail_set_var.pp: -------------------------------------------------------------------------------- 1 | plan basic::xfail_set_var(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | $t = get_targets('foo') 4 | set_var($t, 'key', 'value') 5 | } 6 | } -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/upload.pp: -------------------------------------------------------------------------------- 1 | plan plans::upload(TargetSpec $nodes, String $source) { 2 | upload_file($source, '/b', $nodes) 3 | return upload_file('plans/script', '/d', $nodes) 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/modules/private/plans/yaml.yaml: -------------------------------------------------------------------------------- 1 | description: A plan with a private key 2 | private: true 3 | 4 | steps: 5 | - name: print 6 | targets: localhost 7 | command: echo Initializing 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/failing_task.pp: -------------------------------------------------------------------------------- 1 | plan sample::failing_task ( 2 | TargetSpec $targets = 'localhost' 3 | ) { 4 | return run_task('error::fail', $targets, '_catch_errors' => true) 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/private.yaml: -------------------------------------------------------------------------------- 1 | description: A plan with a private key 2 | private: true 3 | 4 | steps: 5 | - name: print 6 | targets: localhost 7 | command: echo Initializing 8 | -------------------------------------------------------------------------------- /spec/fixtures/projects/named/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan test_project( 2 | TargetSpec $targets 3 | ) { 4 | $target_object = get_target($targets) 5 | return run_command("echo polo", $target_object) 6 | } 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/pdb_fact.pp: -------------------------------------------------------------------------------- 1 | plan basic::pdb_fact(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | $facts = puppetdb_fact(['foo']) 4 | notify { "found ${facts}": } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/download.pp: -------------------------------------------------------------------------------- 1 | plan plans::download(TargetSpec $nodes) { 2 | download_file('plans/dir/prep', 'foo', $nodes) 3 | return download_file('plans/script', 'foo', $nodes) 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/hiera_plan_var.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: 5 | data_hash: yaml_data 6 | 7 | hierarchy: 8 | - name: "Plan var interpolations" 9 | path: "%{plan_var}.yaml" 10 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/plan_hiera.yaml: -------------------------------------------------------------------------------- 1 | version: 5 2 | 3 | hierarchy: 4 | - name: Common 5 | path: hierarchy.yaml 6 | 7 | plan_hierarchy: 8 | - name: Common 9 | path: plan_hierarchy.yaml 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/write_file/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan write_file( 2 | TargetSpec $target, 3 | String $content, 4 | String $destination 5 | ) { 6 | return write_file($content, $destination, $target) 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/error_plugin/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | { "hooks": { 2 | "resolve_reference": { 3 | "task": "error_plugin" }, 4 | "puppet_library": { 5 | "task": "error_plugin" } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/projects/named/plans/apply.pp: -------------------------------------------------------------------------------- 1 | plan test_project::apply( 2 | TargetSpec $targets 3 | ) { 4 | return apply($targets) { 5 | include test_project::notify 6 | } 7 | } 8 | 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/xfail_set_feature.pp: -------------------------------------------------------------------------------- 1 | plan basic::xfail_set_feature(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | $t = get_targets('foo') 4 | set_features($t, 'puppet-agent') 5 | } 6 | } -------------------------------------------------------------------------------- /spec/fixtures/apply/hiera_datadir.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: 5 | datadir: "hiera_datadir" 6 | data_hash: yaml_data 7 | 8 | hierarchy: 9 | - name: "Common" 10 | path: "common.yaml" -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/script.pp: -------------------------------------------------------------------------------- 1 | plan plans::script(TargetSpec $nodes, String $source) { 2 | run_script($source, $nodes) 3 | return run_script('plans/script', $nodes, 'arguments' => ['arg']) 4 | } 5 | -------------------------------------------------------------------------------- /spec/fixtures/projects/embedded/Boltdir/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan embedded( 2 | TargetSpec $targets 3 | ) { 4 | $target_object = get_target($targets) 5 | return run_command("echo polo", $target_object) 6 | } 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/env_var/tasks/ruby_env.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | {"name": "ruby_env.sh", "requirements": ["shell"]}, 4 | {"name": "ruby_env.ps1", "requirements": ["powershell"]} 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/targets_nodes.pp: -------------------------------------------------------------------------------- 1 | # one line plan to show we can run a task by name 2 | plan sample::targets_nodes( 3 | TargetSpec $targets, 4 | TargetSpec $nodes 5 | ) { 6 | return 'done' 7 | } 8 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/plans/run_me_nodes_and_targets.pp: -------------------------------------------------------------------------------- 1 | plan test::run_me_nodes_and_targets( 2 | BoltLib::TargetSpec $nodes, 3 | BoltLib::TargetSpec $targets, 4 | ) { 5 | return $nodes 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/lib/puppet_x/util/warn.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module PuppetX 4 | module Util 5 | def self.warn(msg) 6 | Puppet.warning(msg) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/node_default.pp: -------------------------------------------------------------------------------- 1 | plan basic::node_default(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | node default { 4 | warn { "default node definition": } 5 | } 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/pdb_query.pp: -------------------------------------------------------------------------------- 1 | plan basic::pdb_query(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | $certs = puppetdb_query('nodes[certname] {}') 4 | notify { "found ${certs}": } 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/apply/device_test/plans/facts.pp: -------------------------------------------------------------------------------- 1 | plan device_test::facts( 2 | $nodes = 'localhost', 3 | ) { 4 | 5 | apply_prep($nodes) 6 | $f = get_targets($nodes).map |$t| { [$t.name, $t.facts] } 7 | return($f) 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/my_plug/tasks/resolve_reference.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "My custom plugin", 3 | "parameters": { 4 | "optional_config": { 5 | "type": "Optional[String]" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /acceptance/files/example_apply/lib/puppet_x/util/warn.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module PuppetX 4 | module Util 5 | def self.warn(msg) 6 | Puppet.warning(msg) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/bolt.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # loads Logging gem, patching it for perf reasons to disable plugins 4 | require 'logging_extensions/logging' 5 | 6 | module Bolt 7 | require_relative 'bolt/executor' 8 | end 9 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/documented_param_typo.pp: -------------------------------------------------------------------------------- 1 | # @param not_oops 2 | # Accidentally typoed the param name such that it does not match plan signature 3 | plan sample::documented_param_typo(String $oops = typo){} 4 | -------------------------------------------------------------------------------- /spec/fixtures/modules/parsing/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "parameters": { 3 | "string_bool": { 4 | "type": "Variant[String, Boolean]" 5 | }, 6 | "array": { 7 | "type": "Array" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/bolt_ruby.rb: -------------------------------------------------------------------------------- 1 | #!/foo/ruby 2 | # frozen_string_literal: true 3 | 4 | require 'json' 5 | 6 | result = { 'env' => ENV['PT_message'], 'stdin' => JSON.parse(gets)['message'] } 7 | puts result.to_json 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/command.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | nodes: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: run_command 7 | command: echo hello world 8 | targets: $nodes 9 | 10 | return: $run_command 11 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/plan_with_isolated_subplan.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | message: 3 | type: String 4 | 5 | steps: 6 | - name: undefined_var 7 | plan: yaml::undefined_var 8 | 9 | return: $undefined_var 10 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/task_conf_plug/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "resolve_reference": { 4 | "task": "task_conf_plug" 5 | }, 6 | "secret_decrypt": { "task": "task_conf_plug::value" } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/modules/identity/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "input_method": "stdin", 3 | "implementations": [ 4 | {"name": "win.ps1", "requirements": ["powershell"]}, 5 | {"name": "linux.sh", "requirements": ["shell"]} 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/results/plans/test_result.pp: -------------------------------------------------------------------------------- 1 | plan results::test_result(TargetSpec $nodes){ 2 | $result_set = run_command('echo hi', $nodes) 3 | notice("Result status: ${$result_set.first.status}") 4 | return $result_set 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/whoami.pp: -------------------------------------------------------------------------------- 1 | plan basic::whoami(TargetSpec $nodes) { 2 | $result = apply($nodes) { 3 | exec { "/usr/bin/whoami": 4 | logoutput => true, 5 | } 6 | } 7 | return $result.first.report['logs'] 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/tasks/ruby_task.rb: -------------------------------------------------------------------------------- 1 | #!/opt/puppetlabs/puppet/bin/ruby 2 | # frozen_string_literal: true 3 | 4 | require 'json' 5 | 6 | def hi_from_ruby 7 | { "ruby" => "Hi" } 8 | end 9 | 10 | puts hi_from_ruby.to_json 11 | -------------------------------------------------------------------------------- /spec/fixtures/modules/shareable/tasks/invalid_path.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | {"name": "list.sh", "requirements": ["shell"]}, 4 | {"name": "list.ps1", "requirements": ["powershell"]} 5 | ], 6 | "files": ["shareable/"] 7 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/command.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: run_command 7 | command: echo hello world 8 | targets: $targets 9 | 10 | return: $run_command 11 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/target_param.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: run_command 7 | command: echo hello world 8 | target: $targets 9 | 10 | return: $run_command 11 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan parallel( 2 | TargetSpec $targets 3 | ) { 4 | $ts = get_targets($targets) 5 | return parallelize($ts) |$t| { 6 | run_task('parallel', $t, 'time' => 2, 'val' => 'print') 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "input_method": "stdin", 3 | "implementations": [ 4 | {"name": "win.ps1", "requirements": ["powershell"]}, 5 | {"name": "linux.sh", "requirements": ["shell"]} 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /bolt_spec_spec/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec.configure do |c| 4 | c.mock_with :mocha 5 | end 6 | $LOAD_PATH.unshift File.join(__dir__, '..', '..', 'lib') 7 | require 'puppetlabs_spec_helper/module_spec_helper' 8 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/modules/test/plans/lookup_lambda.pp: -------------------------------------------------------------------------------- 1 | plan test::lookup_lambda( 2 | String $key, 3 | Hash $options = {} 4 | ) { 5 | return lookup($key, $options) |$key| { 6 | "${regsubst($key, '::', ' ', 'G')} lambda" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/modules/results/plans/test_error.pp: -------------------------------------------------------------------------------- 1 | plan results::test_error ( 2 | String $target 3 | ) { 4 | $result = run_task('results', [$target], 'fail' => 'true', '_catch_errors' => true) 5 | return $result.first.error.message 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/modules/shareable/tasks/not_a_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | {"name": "list.sh", "requirements": ["shell"]}, 4 | {"name": "list.ps1", "requirements": ["powershell"]} 5 | ], 6 | "files": ["results/lib/puppet"] 7 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/shareable/tasks/unknown_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | {"name": "list.sh", "requirements": ["shell"]}, 4 | {"name": "list.ps1", "requirements": ["powershell"]} 5 | ], 6 | "files": ["shareable/lib/nope"] 7 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/delegate.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: run_plan 7 | plan: yaml::task 8 | parameters: 9 | targets: $targets 10 | 11 | return: $run_plan 12 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/subdir/init.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: run_command 7 | command: echo I am a yaml plan 8 | targets: $targets 9 | 10 | return: $run_command 11 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/wait/plans/no_future/inner_bg.pp: -------------------------------------------------------------------------------- 1 | plan wait::no_future::inner_bg() { 2 | background() || { 3 | background() || { 4 | return "Thing 2" 5 | } 6 | return "Thing 1" 7 | } 8 | return wait() 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/conf_plug/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "input_method": "stdin", 3 | "implementations": [ 4 | {"name": "win.ps1", "requirements": ["powershell"]}, 5 | {"name": "linux.sh", "requirements": ["shell"]} 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/value.json: -------------------------------------------------------------------------------- 1 | { 2 | "input_method": "stdin", 3 | "implementations": [ 4 | {"name": "value.ps1", "requirements": ["powershell"]}, 5 | {"name": "value.sh", "requirements": ["shell"]} 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/catch_error.pp: -------------------------------------------------------------------------------- 1 | plan basic::catch_error(TargetSpec $nodes, Boolean $catch) { 2 | $result = apply($nodes, _catch_errors => $catch) { 3 | fail('stop the insanity') 4 | } 5 | 6 | return $result.first.error 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/env_var/plans/get_var.pp: -------------------------------------------------------------------------------- 1 | plan env_var::get_var ( 2 | TargetSpec $nodes) { 3 | return( apply($nodes) { 4 | notify { 'gettingvar': 5 | message => Deferred('env_var::get_var', ['test_var']), 6 | } 7 | }) 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/verbose.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | message: 3 | type: String 4 | default: hershey 5 | 6 | steps: 7 | - name: verbose 8 | verbose: $message 9 | description: 'This will call out::verbose(hershey)' 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/private/plans/puppet.pp: -------------------------------------------------------------------------------- 1 | # A plan with a private key 2 | # WARNING: This is an autogenerated plan. It may not behave as expected. 3 | # @private true 4 | plan private::puppet() { 5 | run_command('echo Initializing', 'localhost') 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/modules/resource_types/lib/puppet/provider/my_type/my_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Puppet::Type.type(:my_type).provide(:ruby) do 4 | desc "Empty provider" 5 | 6 | def self.instances 7 | [] 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/sensitive_task_output.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ -z $PT_include_sensitive ]]; then 4 | echo '{"user": "someone"}' 5 | else 6 | echo '{"user": "someone", "_sensitive": { "password": "secretpassword" }}' 7 | fi 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/shareable/tasks/unknown_module.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | {"name": "list.sh", "requirements": ["shell"]}, 4 | {"name": "list.ps1", "requirements": ["powershell"]} 5 | ], 6 | "files": ["not_a_module/files/meh"] 7 | } -------------------------------------------------------------------------------- /spec/fixtures/parallel/background/plans/timing.pp: -------------------------------------------------------------------------------- 1 | plan background::timing() { 2 | $future = background() || { 3 | out::message("Starting backgrounded block") 4 | } 5 | out::message("Returned immediately") 6 | out::message("Type of $future") 7 | } 8 | -------------------------------------------------------------------------------- /dev-resources/windows-kerberos/fixtures/samba-ad/krb5.osx.conf: -------------------------------------------------------------------------------- 1 | [realms] 2 | BOLT.TEST = { 3 | kdc = tcp/samba-ad.bolt.test 4 | admin_server = tcp/samba-ad.bolt.test 5 | } 6 | 7 | [domain_realm] 8 | bolt.test = BOLT.TEST 9 | .bolt.test = BOLT.TEST 10 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/target_vars.pp: -------------------------------------------------------------------------------- 1 | plan basic::target_vars(TargetSpec $nodes) { 2 | $targets = get_targets($nodes) 3 | $targets.each |$t| { $t.set_var('foo', 'hello there') } 4 | 5 | return apply($nodes) { 6 | notify { $foo: } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/modules/facts_test/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan facts_test(String $host) { 2 | $target = get_targets($host)[0] 3 | add_facts($target, { 'kernel' => 'Linux', 'cloud' => { 'provider' => 'AWS' } }) 4 | return "Facts for ${host}: ${facts($target)}" 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/target_preference.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: run_command 7 | command: whoami 8 | target: [] 9 | targets: $targets 10 | 11 | return: $run_command 12 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/wait/plans/no_future/multiple_calls.pp: -------------------------------------------------------------------------------- 1 | plan wait::no_future::multiple_calls ( 2 | TargetSpec $targets 3 | ) { 4 | $first = run_plan('wait::no_future::subplan', $targets) 5 | $second = run_plan('wait::no_future::subplan', $target) 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/api_server_configs/required-bolt-server.conf: -------------------------------------------------------------------------------- 1 | bolt-server: { 2 | ssl-cert: "spec/fixtures/ssl/cert.pem" 3 | ssl-key: "spec/fixtures/ssl/key.pem" 4 | ssl-ca-cert: "spec/fixtures/ssl/ca.pem" 5 | file-server-uri: "https://localhost:8140" 6 | } 7 | -------------------------------------------------------------------------------- /spec/fixtures/modules/env_var/plans/command.pp: -------------------------------------------------------------------------------- 1 | plan env_var::command( 2 | TargetSpec $targets, 3 | String $user 4 | ) { 5 | $vars = { 'chips' => 'and guacamole' } 6 | return run_command('echo $chips', $targets, '_env_vars' => $vars, '_run_as' => $user) 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/results/plans/test_target.pp: -------------------------------------------------------------------------------- 1 | plan results::test_target( 2 | String $node 3 | ) { 4 | $target = Target.new($node) 5 | $target2 = Target.new({'uri' => $target.uri, 'config' => $target.config}) 6 | return run_task('results', $target2) 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/plans/non_parallel.pp: -------------------------------------------------------------------------------- 1 | plan parallel::non_parallel( 2 | TargetSpec $targets 3 | ) { 4 | $ts = get_targets($targets) 5 | parallelize($ts) |$t| { 6 | $a = 2*2 7 | $b = 3+5 8 | } 9 | 10 | return "Success" 11 | } 12 | -------------------------------------------------------------------------------- /.github/actions/windows_agentless_setup/action.yaml: -------------------------------------------------------------------------------- 1 | name: Configure WinRM 2 | description: Setup and test WinRM connection to itself 3 | runs: 4 | using: composite 5 | steps: 6 | - name: Configure WinRM 7 | shell: powershell 8 | run: '& scripts\ci.ps1' 9 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/references.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require 'json' 5 | 6 | values = { 7 | "value" => { 8 | "name" => "127.0.0.1" 9 | } 10 | } 11 | 12 | puts values.to_json 13 | -------------------------------------------------------------------------------- /spec/fixtures/apply/hiera_invalid.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # without specifying version 5, puppet would assume version 3. Apply only supports v5 3 | # version: 5 4 | 5 | defaults: 6 | data_hash: yaml_data 7 | 8 | hierarchy: 9 | - name: "Common" 10 | path: "common.yaml" -------------------------------------------------------------------------------- /spec/fixtures/apply/puppet_types/plans/target_new.pp: -------------------------------------------------------------------------------- 1 | plan puppet_types::target_new( 2 | TargetSpec $targets 3 | ) { 4 | $first = get_target($targets) 5 | $first.apply_prep 6 | 7 | return apply($first) { 8 | $t = Target.new('localhost') 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/apply.pp: -------------------------------------------------------------------------------- 1 | plan plans::apply(TargetSpec $nodes) { 2 | apply($nodes) { 3 | file { '/tmp/foo': 4 | content => 'Hello world!', 5 | } 6 | } 7 | return apply($nodes) { 8 | notify { 'Hey there!': } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/bolt_spec/plans/plans/task.pp: -------------------------------------------------------------------------------- 1 | plan plans::task(TargetSpec $nodes) { 2 | wait_until_available($nodes) 3 | 4 | without_default_logging() || { 5 | run_task('plans::prep', $nodes) 6 | return run_task('plans::foo', $nodes, arg1 => true) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/plan_hiera_facts.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: 5 | data_hash: yaml_data 6 | 7 | plan_hierarchy: 8 | - name: "Interpolations" 9 | path: "os/%{facts.os.name}.yaml" 10 | 11 | - name: "Common" 12 | path: "common.yaml" 13 | -------------------------------------------------------------------------------- /spec/fixtures/modules/analytics/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan analytics ( $nodes ) { 2 | run_task('service', $nodes, name => "puppet", action => status, _catch_errors => true) 3 | run_task('identity', $nodes, name => "puppet", action => status, _catch_errors => true) 4 | 5 | } 6 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/tasks/fail.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | { 4 | "name": "fail.sh", 5 | "requirements": ["shell"] 6 | }, 7 | { 8 | "name": "fail.ps1", 9 | "requirements": ["powershell"] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/resource/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan resource( 2 | TargetSpec $targets 3 | ) { 4 | $t = get_target($targets) 5 | $t.set_resources({'type' => 'File', 6 | 'title' => '/fake/path'}) 7 | return $t.resource('File', '/fake/path') 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/task.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: run_task 7 | task: sample 8 | targets: $targets 9 | parameters: 10 | message: "hello world" 11 | 12 | return: $run_task 13 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/script.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: run_script 7 | script: 'yaml/test.sh' 8 | targets: $targets 9 | arguments: ["foo", "bar", "baz"] 10 | 11 | return: $run_script 12 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/error/tasks/fail.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | { 4 | "name": "fail.sh", 5 | "requirements": ["shell"] 6 | }, 7 | { 8 | "name": "fail.ps1", 9 | "requirements": ["powershell"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /config/local.conf: -------------------------------------------------------------------------------- 1 | bolt-server: { 2 | ssl-cert: "spec/fixtures/ssl/cert.pem" 3 | ssl-key: "spec/fixtures/ssl/key.pem" 4 | ssl-ca-cert: "spec/fixtures/ssl/ca.pem" 5 | file-server-uri: "https://localhost:8140" 6 | cache-dir: "tmp/" 7 | loglevel: "debug" 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/defer.pp: -------------------------------------------------------------------------------- 1 | plan basic::defer(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | notify { 'local pid': 4 | message => pid(), 5 | } 6 | notify { 'remote pid': 7 | message => Deferred('pid', []), 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/invalid_mods/sample/plans/ok.pp: -------------------------------------------------------------------------------- 1 | # one line plan to show we can run a task by name 2 | plan sample::ok(String $nodes) { 3 | $node_array = split($nodes, ',') 4 | run_task ( 5 | "sample::echo", $node_array, 6 | message => "hi there" 7 | ) 8 | } 9 | 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/multiline.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Write a multiline string to the console", 3 | "implementations": [ 4 | {"name": "multiline.ps1", "requirements": ["powershell"]}, 5 | {"name": "multiline.sh", "requirements": ["shell"]} 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/plans/hard_fail.pp: -------------------------------------------------------------------------------- 1 | plan parallel::hard_fail( 2 | TargetSpec $targets 3 | ) { 4 | $ts = get_targets($targets) 5 | return parallelize($ts) |$t| { 6 | foo 7 | run_task('parallel', $t, 'time' => 2, 'val' => $t.name) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/plans/return.pp: -------------------------------------------------------------------------------- 1 | plan parallel::return( 2 | TargetSpec $targets 3 | ) { 4 | $ts = get_targets($targets) 5 | return parallelize($ts) |$t| { 6 | return 'a' 7 | run_task('parallel', $t, 'time' => 2, 'val' => $t.name) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "echo a message", 3 | "input_method": "environment", 4 | "parameters": { 5 | "message": { 6 | "description": "the message", 7 | "type": "String" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/hiera_missing_backend.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: 5 | data_hash: yaml_data 6 | 7 | hierarchy: 8 | - name: missing backend 9 | data_hash: missing_backend 10 | path: common.yaml 11 | 12 | - name: common 13 | path: common.yaml 14 | -------------------------------------------------------------------------------- /spec/fixtures/modules/container/plans/apply.pp: -------------------------------------------------------------------------------- 1 | plan container::apply( 2 | TargetSpec $targets 3 | ) { 4 | apply_prep($targets) 5 | $r = run_container('ubuntu:14.04', 'rm' => true, 'cmd' => 'whoami') 6 | return apply($targets) { 7 | notify { $r.stdout: } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/shareable/tasks/not_a_directory.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | {"name": "list.sh", "requirements": ["shell"]}, 4 | {"name": "list.ps1", "requirements": ["powershell"]} 5 | ], 6 | "files": ["results/lib/puppet/functions/results/make_result.rb/"] 7 | } -------------------------------------------------------------------------------- /docker-compose-bolt-server.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | boltserver: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile.bolt-server 7 | ports: 8 | - "62658:62658" 9 | networks: 10 | default: 11 | external: 12 | name: spec_default 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/modules/test/data/common.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | global: global modules/test/data/common.yaml 3 | test::module: test::module modules/test/data/common.yaml 4 | foo::namespace: foo::namespace modules/test/data/common.yaml 5 | test::merge: 6 | bolt: 7 | key1: value1 8 | key2: value2 -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/empty_resources.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - eval: $targets.apply_prep 7 | - name: apply_resources 8 | targets: $targets 9 | resources: [] 10 | 11 | return: $apply_resources 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/error_plugin/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | { 4 | "name": "init.sh", 5 | "requirements": ["shell"] 6 | }, 7 | { 8 | "name": "init.ps1", 9 | "requirements": ["powershell"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/docs-change.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Docs Change 3 | about: Suggest a change to our documentation. 4 | title: '' 5 | labels: Docs 6 | assignees: '' 7 | --- 8 | 9 | ## Describe the Change You Would Like 10 | A clear and concise description of what you would like changed. 11 | -------------------------------------------------------------------------------- /spec/fixtures/apply/puppet_types/plans/target.pp: -------------------------------------------------------------------------------- 1 | plan puppet_types::target ( 2 | TargetSpec $targets 3 | ) { 4 | $first = get_target($targets) 5 | $first.apply_prep 6 | 7 | return apply($first) { 8 | notify { "ApplyTarget $first protocol: ${first.protocol}": } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/modules/env_var/lib/puppet/functions/env_var/get_var.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Puppet::Functions.create_function(:'env_var::get_var') do 4 | dispatch :get do 5 | param 'String', :var 6 | end 7 | 8 | def get(var) 9 | ENV[var] 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/fixtures/modules/shareable/tasks/list.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | wc -c $PT__installdir/shareable/tasks/unknown_file.json 3 | wc -c $PT__installdir/shareable/tasks/list.sh 4 | wc -c $PT__installdir/error/tasks/fail.sh 5 | wc -c $PT__installdir/results/lib/puppet/functions/results/make_result.rb 6 | -------------------------------------------------------------------------------- /lib/bolt_server/request_error.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'bolt/error' 4 | 5 | module BoltServer 6 | class RequestError < Bolt::Error 7 | def initialize(msg, details = {}) 8 | super(msg, 'bolt-server/request-error', details) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/lib/puppet/functions/load_error.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This should raise a LoadError, as it's not a real gem 4 | require 'fake' 5 | 6 | Puppet::Functions.create_function(:load_error) do 7 | def load_error 8 | puts 'error' 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/fixtures/modules/catch_errors/plans/return.pp: -------------------------------------------------------------------------------- 1 | plan catch_errors::return(TargetSpec $nodes) { 2 | $message = catch_errors() || { 3 | return "You can return a product for up to 30 days from the date you purchased it" 4 | notice("Don't go here") 5 | } 6 | return "Never break the chain" 7 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/catch_plan_run.pp: -------------------------------------------------------------------------------- 1 | # This plan catches a RunFailure from a subplan 2 | plan error::catch_plan_run( 3 | String $target 4 | ) { 5 | $r = run_plan('error::run_fail', 'targets' => $target, '_catch_errors' => true) 6 | return $r.details['result_set'].first.error 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/bolt_ruby.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Task with incompatable shebang to be overriden by interpreter config", 3 | "parameters": { 4 | "message": { 5 | "description": "Test message", 6 | "type": "Optional[String[1]]" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/interpreter.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Task with incompatable shebang to be overriden by interpreter config", 3 | "parameters": { 4 | "message": { 5 | "description": "Test message", 6 | "type": "Optional[String[1]]" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /spec/lib/bolt_spec/sensitive.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet/pops/types/p_sensitive_type' 4 | 5 | module BoltSpec 6 | module Sensitive 7 | def make_sensitive(val) 8 | Puppet::Pops::Types::PSensitiveType::Sensitive.new(val) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/lib/bolt_spec/transport.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'bolt/config' 4 | 5 | module BoltSpec 6 | module Transport 7 | def runner 8 | Bolt::TRANSPORTS[transport].new 9 | end 10 | 11 | def transport_conf 12 | {} 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/fixtures/apply/puppet_types/plans/get_target.pp: -------------------------------------------------------------------------------- 1 | plan puppet_types::get_target( 2 | TargetSpec $targets 3 | ) { 4 | $first = get_target($targets) 5 | $first.apply_prep 6 | 7 | return apply($first) { 8 | $name = get_target($targets).name 9 | notify { $name: } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spec/fixtures/modules/logging/plans/without_default.pp: -------------------------------------------------------------------------------- 1 | plan logging::without_default( 2 | TargetSpec $nodes, 3 | Optional[String] $description = undef, 4 | ) { 5 | without_default_logging() || { 6 | run_task("logging::echo", $nodes, message => "hi there", _catch_errors => true) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/resources.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: apply_resources 7 | targets: $targets 8 | resources: 9 | - notify: "hello world" 10 | - notify: "goodbye" 11 | 12 | return: $apply_resources 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/apply/prep/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan prep(TargetSpec $nodes) { 2 | $nodes.apply_prep 3 | 4 | return apply($nodes) { 5 | notify { "Hello ${$trusted['certname']}": } 6 | notify { 'agent facts': message => "${clientcert}\n${fqdn}\n${clientversion}\n${puppetversion}\n${clientnoop}"} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/invalid_mods/sample/plans/single_task.pp: -------------------------------------------------------------------------------- 1 | # one line plan to show we can run a task by name 2 | plan sample::single_task(String $nodes) { 3 | $node_array = split($nodes, ',') 4 | run_task ( 5 | "sample::echo", $node_array, 6 | message => "hi there" 7 | # error: missing close paren 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/error.pp: -------------------------------------------------------------------------------- 1 | plan basic::error(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | debug('Debugging') 4 | info('Meh') 5 | notice('Helpful') 6 | warning('Warned') 7 | err('Fire') 8 | alert('Stop') 9 | crit('Drop') 10 | emerg('Roll') 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/strict.pp: -------------------------------------------------------------------------------- 1 | plan basic::strict(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | # Use a class. While we don't enforce strict language on the CatalogCompiler, 4 | # we still do in the plan language which is parsing manifest blocks. 5 | include basic::strict 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/tasks/typed.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | { 4 | "name": "typed.sh", 5 | "requirements": ["shell"] 6 | }, 7 | { 8 | "name": "typed.ps1", 9 | "requirements": ["powershell"], 10 | "input_method": "environment" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/sleep.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "A sleep task", 3 | "implementations": [ 4 | { 5 | "name": "sleep.sh", 6 | "requirements": ["shell"] 7 | }, 8 | { 9 | "name": "sleep.ps1", 10 | "requirements": ["powershell"] 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/plans/catch_error_inner.pp: -------------------------------------------------------------------------------- 1 | plan parallel::catch_error_inner( 2 | TargetSpec $targets 3 | ) { 4 | $ts = get_targets($targets) 5 | parallelize($ts) |$t| { 6 | catch_errors() || { 7 | run_task('error::fail', $t) 8 | } 9 | } 10 | return "We made it" 11 | } 12 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/plans/catch_error_outer.pp: -------------------------------------------------------------------------------- 1 | plan parallel::catch_error_outer( 2 | TargetSpec $targets 3 | ) { 4 | $ts = get_targets($targets) 5 | catch_errors() || { 6 | parallelize($ts) |$t| { 7 | run_task('error::fail', $t) 8 | } 9 | } 10 | return "We made it" 11 | } 12 | -------------------------------------------------------------------------------- /spec/fixtures/modules/catch_errors/plans/break.pp: -------------------------------------------------------------------------------- 1 | plan catch_errors::break( 2 | TargetSpec $nodes, 3 | Array $list 4 | ) { 5 | $list.each |$elem| { 6 | catch_errors() || { 7 | notice($elem) 8 | break() 9 | notice("Out of bounds") 10 | } 11 | } 12 | return "Break the chain" 13 | } -------------------------------------------------------------------------------- /spec/fixtures/modules/container/plans/volume.pp: -------------------------------------------------------------------------------- 1 | plan container::volume( 2 | String $image = 'ubuntu:14.04', 3 | String $ls, 4 | String $src, 5 | String $dest 6 | ) { 7 | $opts = { 'volumes' => { $src => $dest }, 'cmd' => "${$ls} ${$dest}", 'rm' => true} 8 | return run_container($image, $opts) 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/logs/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan logs () { 2 | log::trace('This is a trace message') 3 | log::debug('This is a debug message') 4 | log::warn('This is a warn message') 5 | log::info('This is an info message') 6 | log::error('This is an error message') 7 | log::fatal('This is a fatal message') 8 | } 9 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Task with invalid metadata", 3 | "input_method": "stdin", 4 | "parameters": { 5 | "string": { 6 | "description": "Mandatory string parameter", 7 | "type": "String[1, 10]" 8 | } 9 | }, 10 | "anything": true 11 | } 12 | -------------------------------------------------------------------------------- /acceptance/files/example_apply/plans/puppet_status.pp: -------------------------------------------------------------------------------- 1 | plan example_apply::puppet_status (TargetSpec $nodes) { 2 | $targets = get_targets($nodes) 3 | $targets.each |$target| { 4 | set_feature($target, 'puppet-agent', true) 5 | } 6 | return run_task('service', $targets, 'action' => 'status', 'name' => 'puppet') 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/success.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "A successful task", 3 | "implementations": [ 4 | { 5 | "name": "success.sh", 6 | "requirements": ["shell"] 7 | }, 8 | { 9 | "name": "success.ps1", 10 | "requirements": ["powershell"] 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/download.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | destination: 5 | type: String 6 | 7 | steps: 8 | - name: download_file 9 | download: '/etc/ssh/ssh_config' 10 | destination: $destination 11 | targets: $targets 12 | 13 | return: $download_file 14 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/tasks/interpreter.py: -------------------------------------------------------------------------------- 1 | #!/foo/python 2 | 3 | import os 4 | import fileinput 5 | import json 6 | 7 | for line in fileinput.input(): 8 | input_data = json.loads(line) 9 | if input_data['message']: 10 | print(json.dumps({'env': os.environ['PT_message'], 'stdin': input_data['message']})) 11 | -------------------------------------------------------------------------------- /spec/fixtures/modules/shareable/tasks/list.ps1: -------------------------------------------------------------------------------- 1 | (Get-Item $env:PT__installdir/shareable/tasks/unknown_module.json).length 2 | (Get-Item $env:PT__installdir/shareable/tasks/list.ps1).length 3 | (Get-Item $env:PT__installdir/error/tasks/fail.sh).length 4 | (Get-Item $env:PT__installdir/results/lib/puppet/functions/results/make_result.rb).length -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/node_definition.pp: -------------------------------------------------------------------------------- 1 | plan basic::node_definition(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | # We don't know the node name that will be used in the test, so we have to 4 | # just match everything 5 | node /.+/ { 6 | warn { "named node definition": } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /spec/fixtures/modules/error/plans/winrm_disconnect.pp: -------------------------------------------------------------------------------- 1 | plan error::winrm_disconnect( 2 | TargetSpec $targets 3 | ) { 4 | $result = run_command('restart-service winrm', $targets, _catch_errors => true) 5 | wait_until_available($targets, _catch_errors => true) 6 | return run_command('get-service |? name -like winrm', $targets) 7 | } 8 | 9 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/conf_plug/bolt_plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "resolve_reference": { 4 | "task": "conf_plug" 5 | } 6 | }, 7 | "config": { 8 | "optional_key": { 9 | "type": "Optional[String]" 10 | }, 11 | "required_key": { 12 | "type": "String" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/sensitive_test/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan sensitive_test ( 2 | Sensitive $array, 3 | Sensitive $hash, 4 | Sensitive $string 5 | ) { 6 | $result = { 7 | 'array' => $array.unwrap, 8 | 'hash' => $hash.unwrap, 9 | 'string' => $string.unwrap 10 | } 11 | 12 | return $result 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/strict_variables.pp: -------------------------------------------------------------------------------- 1 | plan basic::strict_variables(TargetSpec $nodes) { 2 | return apply($nodes) { 3 | # Use a class. While we don't enforce strict_variables on the CatalogCompiler, 4 | # we still do in the plan language which is parsing manifest blocks. 5 | include basic::strict_variables 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/data/common.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | environment: environment data/common.yaml 3 | test::interpolations: test::interpolations data/common.yaml 4 | test::backends: test::backends data/common.yaml 5 | test::custom: test::custom data/common.yaml 6 | test::merge: 7 | puppet: 8 | key1: value1 9 | bolt: 10 | key2: value1 11 | -------------------------------------------------------------------------------- /spec/fixtures/apply/prep/plans/run_as.pp: -------------------------------------------------------------------------------- 1 | plan prep::run_as(TargetSpec $targets) { 2 | apply_prep($targets, '_run_as' => 'root') 3 | 4 | return apply($targets) { 5 | notify { "Hello ${$trusted['certname']}": } 6 | notify { 'agent facts': message => "${clientcert}\n${fqdn}\n${clientversion}\n${puppetversion}\n${clientnoop}"} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /bolt-modules/ctrl/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | 5 | # Ensure tasks are enabled when rspec-puppet sets up an environment 6 | # so we get task loaders. 7 | Puppet[:tasks] = true 8 | RSpec.configure do |c| 9 | c.mock_with :mocha 10 | end 11 | require 'puppetlabs_spec_helper/module_spec_helper' 12 | -------------------------------------------------------------------------------- /bolt-modules/dir/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | 5 | # Ensure tasks are enabled when rspec-puppet sets up an environment 6 | # so we get task loaders. 7 | Puppet[:tasks] = true 8 | RSpec.configure do |c| 9 | c.mock_with :mocha 10 | end 11 | require 'puppetlabs_spec_helper/module_spec_helper' 12 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | 5 | # Ensure tasks are enabled when rspec-puppet sets up an environment 6 | # so we get task loaders. 7 | Puppet[:tasks] = true 8 | RSpec.configure do |c| 9 | c.mock_with :mocha 10 | end 11 | require 'puppetlabs_spec_helper/module_spec_helper' 12 | -------------------------------------------------------------------------------- /modules/aggregate/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | 5 | # Ensure tasks are enabled when rspec-puppet sets up an environment 6 | # so we get task loaders. 7 | Puppet[:tasks] = true 8 | RSpec.configure do |c| 9 | c.mock_with :mocha 10 | end 11 | require 'puppetlabs_spec_helper/module_spec_helper' 12 | -------------------------------------------------------------------------------- /modules/canary/spec/functions/random_split_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'bolt/target' 5 | 6 | describe 'canary::random_split' do 7 | it 'with given host' do 8 | # Can't test randomness with and_returns 9 | is_expected.to run.with_params(%w[host1 host2 host3], 1) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /modules/canary/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | 5 | # Ensure tasks are enabled when rspec-puppet sets up an environment 6 | # so we get task loaders. 7 | Puppet[:tasks] = true 8 | RSpec.configure do |c| 9 | c.mock_with :mocha 10 | end 11 | require 'puppetlabs_spec_helper/module_spec_helper' 12 | -------------------------------------------------------------------------------- /spec/fixtures/apply/puppet_types/plans/get_targets.pp: -------------------------------------------------------------------------------- 1 | plan puppet_types::get_targets( 2 | TargetSpec $targets 3 | ) { 4 | $first = get_target($targets) 5 | $first.apply_prep 6 | 7 | return apply($first) { 8 | $names = get_targets($targets).map |$t| { 9 | $t.name 10 | } 11 | notify { $names.join(","): } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/apply/puppet_types/plans/resultset.pp: -------------------------------------------------------------------------------- 1 | plan puppet_types::resultset ( 2 | TargetSpec $targets 3 | ) { 4 | $first = get_targets($targets)[0] 5 | $first.apply_prep 6 | 7 | $result = run_command('whoami', $targets) 8 | 9 | return apply($first) { 10 | notify { "ResultSet target names: ${$result.names}": } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spec/fixtures/modules/resources/plans/add_event.pp: -------------------------------------------------------------------------------- 1 | plan resources::add_event( 2 | TargetSpec $targets 3 | ) { 4 | $t = get_target($targets) 5 | $r = ResourceInstance.new({ 6 | 'target' => $t, 7 | 'type' => Package, 8 | 'title' => 'openssl' 9 | }) 10 | $r.add_event({'update' => { 'time' => 'warp' }}) 11 | return $r 12 | } 13 | -------------------------------------------------------------------------------- /bolt-modules/system/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | 5 | # Ensure tasks are enabled when rspec-puppet sets up an environment 6 | # so we get task loaders. 7 | Puppet[:tasks] = true 8 | RSpec.configure do |c| 9 | c.mock_with :mocha 10 | end 11 | require 'puppetlabs_spec_helper/module_spec_helper' 12 | -------------------------------------------------------------------------------- /modules/puppet_connect/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | 5 | # Ensure tasks are enabled when rspec-puppet sets up an environment 6 | # so we get task loaders. 7 | Puppet[:tasks] = true 8 | RSpec.configure do |c| 9 | c.mock_with :mocha 10 | end 11 | require 'puppetlabs_spec_helper/module_spec_helper' 12 | -------------------------------------------------------------------------------- /modules/puppetdb_fact/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | 5 | # Ensure tasks are enabled when rspec-puppet sets up an environment 6 | # so we get task loaders. 7 | Puppet[:tasks] = true 8 | RSpec.configure do |c| 9 | c.mock_with :mocha 10 | end 11 | require 'puppetlabs_spec_helper/module_spec_helper' 12 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/wait/plans/no_future/subplan.pp: -------------------------------------------------------------------------------- 1 | plan wait::no_future::subplan( 2 | TargetSpec $targets 3 | ) { 4 | background("subplan background") || { 5 | run_plan("wait::no_future::basic", $targets) 6 | return "Just a subplan, hold the mustard" 7 | } 8 | run_plan("wait::no_future::basic", $targets) 9 | return wait() 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/plugin_modules/identity/tasks/resolve_reference.json: -------------------------------------------------------------------------------- 1 | { 2 | "parameters": { 3 | "value": { "type": "Any" } 4 | }, 5 | "input_method": "stdin", 6 | "implementations": [ 7 | {"name": "resolve_reference.ps1", "requirements": ["powershell"]}, 8 | {"name": "resolve_reference.sh", "requirements": ["shell"]} 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/apply/device_test/plans/set_a_val.pp: -------------------------------------------------------------------------------- 1 | plan device_test::set_a_val( 2 | $key = 'key1', 3 | $val = 'val1', 4 | $nodes = 'localhost' 5 | ) { 6 | # rely on the agent already being installed 7 | apply_prep($nodes) 8 | 9 | $r = apply($nodes) { 10 | fake_device { $key: 11 | content => $val 12 | } 13 | } 14 | return $r 15 | } 16 | -------------------------------------------------------------------------------- /spec/fixtures/apply/puppet_types/plans/error.pp: -------------------------------------------------------------------------------- 1 | plan puppet_types::error( 2 | TargetSpec $targets 3 | ) { 4 | $first = get_target($targets) 5 | $first.apply_prep 6 | 7 | $error = run_command("not real", $targets, _catch_errors => true) 8 | return apply($first) { 9 | notify { "ApplyResult resource: ${$error[0].error.message}": } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/upload.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: upload_file 7 | upload: 'yaml/test.sh' 8 | destination: '/tmp/test_upload.sh' 9 | targets: $targets 10 | - name: cleanup 11 | command: rm '/tmp/test_upload.sh' 12 | targets: $targets 13 | 14 | return: $upload_file 15 | -------------------------------------------------------------------------------- /spec/lib/bolt_spec/config.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'bolt/config' 4 | 5 | module BoltSpec 6 | module Config 7 | def make_config(overrides = {}) 8 | overrides = Bolt::Util.walk_keys(overrides, &:to_s) 9 | project = Bolt::Project.new({}, '.') 10 | Bolt::Config.new(project, overrides) 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /dev-resources/windows-kerberos/fixtures/omiserver/sssd.conf.tmpl: -------------------------------------------------------------------------------- 1 | # https://linux.die.net/man/5/sssd-ad 2 | [sssd] 3 | services = nss, pam 4 | config_file_version = 2 5 | domains = ${KRB5_REALM} 6 | 7 | [nss] 8 | debug_level = 6 9 | 10 | [domain/${KRB5_REALM}] 11 | id_provider = ad 12 | access_provider = ad 13 | fallback_homedir = /home/%u@%d 14 | debug_level = 6 15 | -------------------------------------------------------------------------------- /spec/fixtures/modules/catch_errors/plans/init.pp: -------------------------------------------------------------------------------- 1 | plan catch_errors( 2 | TargetSpec $nodes, 3 | Boolean $fail = true 4 | ) { 5 | $errors = catch_errors() || { 6 | if $fail { 7 | run_task('error::fail', $nodes) 8 | } else { 9 | run_command("echo 'Unepic unfailure'", $nodes) 10 | } 11 | } 12 | notice("Step 1") 13 | return $errors 14 | } -------------------------------------------------------------------------------- /config/docker.conf: -------------------------------------------------------------------------------- 1 | bolt-server: { 2 | ssl-cert: "spec/fixtures/ssl/cert.pem" 3 | ssl-key: "spec/fixtures/ssl/key.pem" 4 | ssl-ca-cert: "spec/fixtures/ssl/ca.pem" 5 | file-server-uri: "https://spec_puppetserver_1:8140" 6 | projects-dir: "/opt/puppetlabs/server/data/orchestration-services/projects" 7 | loglevel: debug 8 | host: "0.0.0.0" 9 | } 10 | -------------------------------------------------------------------------------- /exe/bolt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require 'bolt' 5 | require 'bolt/cli' 6 | 7 | Thread.current[:name] ||= 'main' 8 | cli = Bolt::CLI.new(ARGV) 9 | begin 10 | opts = cli.parse 11 | exitcode = cli.execute(opts) 12 | exit exitcode 13 | rescue Bolt::CLIExit 14 | exit 15 | rescue Bolt::Error => e 16 | exit e.error_code 17 | end 18 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/modules/test/plans/plan_lookup.pp: -------------------------------------------------------------------------------- 1 | plan test::plan_lookup( 2 | TargetSpec $targets 3 | ) { 4 | $outside_apply = lookup('pop') 5 | $in_apply = apply($targets) { 6 | notify { lookup('pop'): } 7 | } 8 | $a = { 'outside_apply' => $outside_apply, 9 | 'in_apply' => $in_apply.first.report['resource_statuses'] } 10 | return $a 11 | } 12 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/lib/puppet/provider/warn/basic.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_x/util/warn' 4 | 5 | Puppet::Type.type(:warn).provide(:basic) do 6 | desc 'Basic implementation of the warn type' 7 | 8 | confine another: "I'm" 9 | confine feature: :can_warn 10 | 11 | def warn(msg) 12 | PuppetX::Util.warn(msg) 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /spec/fixtures/modules/shareable/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "implementations": [ 3 | {"name": "list.sh", "requirements": ["shell"], "files": ["shareable/tasks/unknown_file.json"]}, 4 | {"name": "list.ps1", "requirements": ["powershell"], "files": ["shareable/tasks/unknown_module.json"], "input_method": "environment"} 5 | ], 6 | "files": ["results/lib/", "error/tasks/fail.sh"] 7 | } -------------------------------------------------------------------------------- /.github/actions/docker_setup/action.yaml: -------------------------------------------------------------------------------- 1 | name: Docker containers 2 | description: Start Docker containers required for Bolt tests 3 | runs: 4 | using: composite 5 | steps: 6 | - name: Bring up containers 7 | shell: bash 8 | run: | 9 | docker compose -f spec/docker-compose.yml build --parallel 10 | docker compose -f spec/docker-compose.yml up -d 11 | -------------------------------------------------------------------------------- /acceptance/files/example_apply/lib/puppet/provider/warn/basic.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_x/util/warn' 4 | 5 | Puppet::Type.type(:warn).provide(:basic) do 6 | desc 'Basic implementation of the warn type' 7 | 8 | confine another: "I'm" 9 | confine feature: :can_warn 10 | 11 | def warn(msg) 12 | PuppetX::Util.warn(msg) 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/bolt_server/schemas/partials/target-any.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "partial:target-any", 3 | "$schema": "http://json-schema.org/draft-04/schema", 4 | "title": "Target information about where to run a bolt action, either over SSH or WinRM", 5 | "type": "object", 6 | "anyOf": [ 7 | { "$ref": "partial:target-ssh" }, 8 | { "$ref": "partial:target-winrm" } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/invalid.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | description: A list of targets to run actions on 5 | default: localhost 6 | 7 | # The steps key defines the actions the plan will take in order. 8 | steps: 9 | - resources: 10 | - class: prometheus 11 | targets: $targets 12 | description: 'Install prometheus' 13 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/background/plans/error.pp: -------------------------------------------------------------------------------- 1 | plan background::error( 2 | TargetSpec $targets, 3 | Boolean $sleep = false 4 | ) { 5 | background() || { 6 | run_command("exit 1", $targets) 7 | out::message("Finished backgrounded block") 8 | } 9 | 10 | if $sleep { 11 | run_command("sleep 1", $targets) 12 | } 13 | return 'Still ran successfully' 14 | } 15 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/parallel/plans/error.pp: -------------------------------------------------------------------------------- 1 | plan parallel::error( 2 | TargetSpec $targets 3 | ) { 4 | $ts = get_targets($targets) 5 | parallelize($ts) |$t| { 6 | if $t.port == 20024 { 7 | run_task('error::fail', $t) 8 | } else { 9 | run_task('parallel', $t, 'time' => 0, 'val' => 'a') 10 | } 11 | } 12 | 13 | return "We shouldn't get here" 14 | } 15 | -------------------------------------------------------------------------------- /.github/actions/windows_agent_setup/action.yaml: -------------------------------------------------------------------------------- 1 | name: Configure WinRM and use Puppet's Ruby 2 | description: Setup and test WinRM connection to itself, and use Puppet's Ruby 3 | runs: 4 | using: composite 5 | steps: 6 | - name: Configure WinRM and use Puppet's Ruby 7 | shell: powershell 8 | run: | 9 | . scripts\ci.ps1 10 | Set-ActiveRubyFromPuppet 11 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: .rubocop_todo.yml 2 | 3 | plugins: rubocop-rake 4 | 5 | AllCops: 6 | NewCops: enable 7 | Exclude: 8 | - Boltdir/**/* 9 | - vendor/**/* 10 | - vendored/**/* 11 | - acceptance/vendor/**/* 12 | - modules/**/* 13 | - docs/**/* 14 | - site-modules/**/* 15 | - tasks/**/* 16 | SuggestExtensions: false 17 | TargetRubyVersion: 3.0 18 | -------------------------------------------------------------------------------- /spec/fixtures/apply/puppet_types/plans/sensitive_result.pp: -------------------------------------------------------------------------------- 1 | plan puppet_types::sensitive_result ( 2 | TargetSpec $targets 3 | ) { 4 | $target = get_target($targets) 5 | $target.apply_prep 6 | 7 | $result = run_task('sensitive', $target).first 8 | 9 | return apply($target) { 10 | notify { "Result sensitive value: ${$result.sensitive.unwrap['password']}": } 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/modules/container/plans/parallel.pp: -------------------------------------------------------------------------------- 1 | plan container::parallel( 2 | TargetSpec $targets = 'localhost', 3 | String $image = 'ubuntu:14.04' 4 | ) { 5 | $_targets = get_targets($targets) 6 | parallelize($_targets) |$t| { 7 | run_container($image, 'rm' => true, 'cmd' => "sh -c 'sleep 2 && echo \"Yes\"'") 8 | run_command("echo \"Who's on first?\"", $t) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /bolt-modules/log/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | require 'bolt/pal' 5 | 6 | # Ensure tasks are enabled when rspec-puppet sets up an environment 7 | # so we get task loaders. 8 | Puppet[:tasks] = true 9 | Bolt::PAL.load_puppet 10 | RSpec.configure do |c| 11 | c.mock_with :mocha 12 | end 13 | require 'puppetlabs_spec_helper/module_spec_helper' 14 | -------------------------------------------------------------------------------- /bolt-modules/out/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | require 'bolt/pal' 5 | 6 | # Ensure tasks are enabled when rspec-puppet sets up an environment 7 | # so we get task loaders. 8 | Puppet[:tasks] = true 9 | Bolt::PAL.load_puppet 10 | RSpec.configure do |c| 11 | c.mock_with :mocha 12 | end 13 | require 'puppetlabs_spec_helper/module_spec_helper' 14 | -------------------------------------------------------------------------------- /lib/bolt/puppetdb.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative '../bolt/error' 4 | require_relative 'puppetdb/client' 5 | require_relative 'puppetdb/config' 6 | 7 | module Bolt 8 | class PuppetDBError < Bolt::Error 9 | def initialize(msg) 10 | super(msg, "bolt/puppetdb-error") 11 | end 12 | end 13 | 14 | class PuppetDBFailoverError < PuppetDBError; end 15 | end 16 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | require 'bolt/pal' 5 | 6 | # Ensure tasks are enabled when rspec-puppet sets up an environment 7 | # so we get task loaders. 8 | Puppet[:tasks] = true 9 | Bolt::PAL.load_puppet 10 | RSpec.configure do |c| 11 | c.mock_with :mocha 12 | end 13 | require 'puppetlabs_spec_helper/module_spec_helper' 14 | -------------------------------------------------------------------------------- /bolt-modules/prompt/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet_pal' 4 | require 'bolt/pal' 5 | 6 | # Ensure tasks are enabled when rspec-puppet sets up an environment 7 | # so we get task loaders. 8 | Puppet[:tasks] = true 9 | Bolt::PAL.load_puppet 10 | RSpec.configure do |c| 11 | c.mock_with :mocha 12 | end 13 | require 'puppetlabs_spec_helper/module_spec_helper' 14 | -------------------------------------------------------------------------------- /developer-docs/examples/bolt_spec_example/tasks/init.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Task to write content to a given filepath", 3 | "parameters": { 4 | "file": { 5 | "description": "Path to file to write content to", 6 | "type": "String[1]" 7 | }, 8 | "content": { 9 | "description": "Content to write to a file", 10 | "type": "String[1]" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/param_passing.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | n: 3 | type: Integer 4 | default: 12 5 | 6 | steps: 7 | - name: doubled 8 | eval: $n * 2 9 | - name: tripled 10 | eval: $n * 3 11 | - name: quintupled 12 | eval: $doubled + $tripled 13 | - name: stringified 14 | eval: "${quintupled}" 15 | 16 | return: [$doubled, $tripled, $quintupled, $stringified] 17 | -------------------------------------------------------------------------------- /spec/fixtures/modules/yaml/plans/resource_failure.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | targets: 3 | type: TargetSpec 4 | 5 | steps: 6 | - name: apply_resources 7 | targets: $targets 8 | resources: 9 | - notify: "hello world" 10 | - file: "/tmp/foo/bar/baz" 11 | parameters: 12 | ensure: present 13 | - notify: "goodbye" 14 | 15 | return: $apply_resources 16 | 17 | 18 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/functions/file/write_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'tempfile' 5 | 6 | describe 'file::write' do 7 | it { 8 | Dir.mktmpdir do |dir| 9 | file = File.join(dir, 'file_write') 10 | is_expected.to run.with_params(file, 'some content') 11 | expect(File.read(file)).to eq('some content') 12 | end 13 | } 14 | end 15 | -------------------------------------------------------------------------------- /bolt-modules/system/spec/functions/system/env_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'system::env' do 6 | it { 7 | is_expected.to run.with_params('USER').and_return(ENV['USER']) 8 | } 9 | 10 | it "doesn't error for unknown envars" do 11 | is_expected.to run.with_params('thiskeyprobablydoesntexistanywhere').and_return(nil) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/fixtures/apply/puppet_types/plans/result.pp: -------------------------------------------------------------------------------- 1 | plan puppet_types::result ( 2 | TargetSpec $targets 3 | ) { 4 | $target = get_target($targets) 5 | $target.apply_prep 6 | 7 | $result = run_command('whoami', $target).first 8 | 9 | return apply($target) { 10 | notify { "Result value: ${$result.value['stdout']}": } 11 | notify { "Result target name: ${$result.target.name}": } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spec/fixtures/keys/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSjBBtrKv2GvBfd7HQUeRQdXMgNHi59PEV54Coccz0HD42k5wSHtXeIPb+BdiPvFEcd2bqXFhbxzYPM39nhOJqo+nATFiYoynExGwdd7toaPnMAqWLNjBIjlf99i1VnTK6g9G4D6FFk3Ibdx0v1+TptaA21MS2LwUE6bmHJYPTEJy8/NZi7kCpOuMClAXwO9M9xoPnhjHQ3lxfSNFmUScDgD+iY7bsB98VRktpK7QWbMwzdX7IvlLqD3JUAyYHzy3D0pPMqWvCSt0ZchdYIlvV1pATCstB3lAmtm6IV0dsdFF5l2aLIgdgHPYLxzqhCQuDJA16r+RKqKJMg4636z9R adreyer@clavelin 2 | -------------------------------------------------------------------------------- /spec/fixtures/modules/sample/plans/two_tasks.pp: -------------------------------------------------------------------------------- 1 | plan sample::two_tasks(String $first_targets, String $second_targets) { 2 | 3 | $first_array = split($first_targets, ',') 4 | $second_array = split($second_targets, ',') 5 | 6 | run_task(sample::echo, $first_array, 7 | message => "first task", 8 | ) 9 | 10 | run_task(sample::echo, $second_array, 11 | message => "second task", 12 | ) 13 | 14 | } 15 | -------------------------------------------------------------------------------- /spec/fixtures/run_as/test/plans/run_as_user.pp: -------------------------------------------------------------------------------- 1 | plan test::run_as_user(String $target, String $user) { 2 | run_command('whoami', $target, _run_as => $user) 3 | upload_file('test/id.sh', "/home/${user}/id.sh", $target, _run_as => $user) 4 | run_script('test/id.sh', $target, _run_as => $user) 5 | run_task('test::id', $target, _run_as => $user) 6 | return run_plan(test::whoami, target => $target, _run_as => $user) 7 | } 8 | -------------------------------------------------------------------------------- /bolt-modules/ctrl/spec/functions/ctrl/sleep_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'ctrl::sleep' do 6 | it { 7 | now = Time.now 8 | is_expected.to run.with_params(1) 9 | expect(Time.now - now).to be >= 1 10 | } 11 | 12 | it { 13 | now = Time.now 14 | is_expected.to run.with_params(0.5) 15 | expect(Time.now - now).to be >= 0.5 16 | } 17 | end 18 | -------------------------------------------------------------------------------- /spec/lib/bolt_spec/errors.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module BoltSpec 4 | module Errors 5 | def expect_node_error(klass, issue_code, message) 6 | expect { 7 | yield 8 | }.to(raise_error { |ex| 9 | expect(ex).to be_a(klass) 10 | expect(ex.issue_code).to eq(issue_code) 11 | expect(ex.message).to match(message) 12 | }) 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/fixtures/inventory/docker.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | groups: 4 | - name: ssh 5 | targets: 6 | - name: ubuntu_node 7 | alias: agentless 8 | config: 9 | ssh: 10 | port: 20022 11 | - name: puppet_6_node 12 | config: 13 | ssh: 14 | port: 20024 15 | config: 16 | ssh: 17 | host: localhost 18 | host-key-check: false 19 | user: root 20 | password: root 21 | -------------------------------------------------------------------------------- /spec/fixtures/apply/basic/plans/project_files.pp: -------------------------------------------------------------------------------- 1 | plan basic::project_files ( 2 | TargetSpec $targets, 3 | String $project_name 4 | ) { 5 | $result = apply($targets) { 6 | file { '/test.txt': 7 | source => "puppet:///modules/${project_name}/testfile" 8 | } 9 | } 10 | 11 | apply($targets) { 12 | file { '/test.txt': 13 | ensure => absent 14 | } 15 | } 16 | 17 | return $result 18 | } 19 | -------------------------------------------------------------------------------- /spec/fixtures/parallel/background/plans/variables.pp: -------------------------------------------------------------------------------- 1 | plan background::variables( 2 | TargetSpec $targets, 3 | Optional[String] $undef = undef 4 | ) { 5 | $var = 'Before background' 6 | $future = background() || { 7 | out::message("Inside background: $var") 8 | out::message("Undef: $undef") 9 | out::message("Foo: $foo") 10 | } 11 | $foo = 'After background' 12 | out::message("In main plan: $foo") 13 | } 14 | -------------------------------------------------------------------------------- /modules/canary/lib/puppet/functions/canary/merge.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Merges two ResultSets into a new ResultSet 4 | Puppet::Functions.create_function(:'canary::merge') do 5 | dispatch :merge_results do 6 | param 'ResultSet', :merger 7 | param 'ResultSet', :mergee 8 | end 9 | 10 | def merge_results(merger, mergee) 11 | Bolt::ResultSet.new(merger.results + mergee.results) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/fixtures/apply/device_test/lib/puppet/transport/schema/fake.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'puppet/resource_api' 4 | 5 | Puppet::ResourceApi.register_transport( 6 | name: 'fake', 7 | desc: 'This device just modifies a file on the on controller', 8 | features: [], 9 | connection_info: { 10 | path: { 11 | type: 'String', 12 | desc: 'The path the devices file' 13 | } 14 | } 15 | ) 16 | -------------------------------------------------------------------------------- /spec/fixtures/hiera/hiera_interpolations.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: 5 | data_hash: yaml_data 6 | 7 | hierarchy: 8 | - name: "Fact interpolations" 9 | path: "os/%{facts.os.name}.yaml" 10 | 11 | - name: "Var interpolations" 12 | path: "%{lookup}.yaml" 13 | 14 | - name: "Trusted interpolations" 15 | path: "nodes/%{trusted.certname}.yaml" 16 | 17 | - name: "Common" 18 | path: "common.yaml" 19 | -------------------------------------------------------------------------------- /acceptance/config/package/options.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | { 4 | pre_suite: [ 5 | 'setup/package/pre-suite/020_install.rb', 6 | 'setup/common/pre-suite/030_set_password.rb', 7 | 'setup/common/pre-suite/031_add_local_nix_user.rb', 8 | 'setup/common/pre-suite/032_configure_windows_profile.rb', 9 | 'setup/common/pre-suite/050_build_bolt_inventory.rb' 10 | ], 11 | load_path: './lib/acceptance' 12 | } 13 | -------------------------------------------------------------------------------- /bolt-modules/boltlib/spec/fixtures/modules/test/tasks/undef.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "undef task", 3 | "input_method": "environment", 4 | "parameters": { 5 | "undef_default": { 6 | "description": "parameter with default", 7 | "type": "String", 8 | "default": "foo" 9 | }, 10 | "undef_no_default": { 11 | "description": "parameter with no default", 12 | "type": "Any" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /bolt-modules/file/spec/functions/file/delete_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | require 'tempfile' 5 | 6 | describe 'file::delete' do 7 | it { 8 | Dir.mktmpdir do |dir| 9 | file = File.join(dir, 'file_delete') 10 | File.write(file, 'file_delete_contents') 11 | is_expected.to run.with_params(file) 12 | expect(File.exist?(file)).to eq(false) 13 | end 14 | } 15 | end 16 | -------------------------------------------------------------------------------- /dev-resources/windows-kerberos/fixtures/omiserver/realmd.conf.tmpl: -------------------------------------------------------------------------------- 1 | [users] 2 | default-home = /home/%D/%U 3 | default-shell = /bin/bash 4 | 5 | [active-directory] 6 | default-client = sssd 7 | os-name = Ubuntu Desktop Linux 8 | os-version = 16.04 9 | 10 | [service] 11 | automatic-install = no 12 | 13 | [${KRB5_REALM_LOWER}] 14 | fully-qualified-names = no 15 | automatic-id-mapping = yes 16 | user-principal = yes 17 | manage-system = no 18 | -------------------------------------------------------------------------------- /spec/fixtures/modules/results/plans/test_printing.pp: -------------------------------------------------------------------------------- 1 | plan results::test_printing( 2 | String $host, 3 | String $user, 4 | String $password, 5 | Integer $port 6 | ) { 7 | $config = { 8 | 'local' => { 9 | 'user' => $user, 10 | 'password' => $password, 11 | 'port' => $port 12 | } 13 | } 14 | $target = Target.new({'name' => $host, 'config' => $config}) 15 | notice("Connected to ${target.name}") 16 | } 17 | -------------------------------------------------------------------------------- /documentation/plans.md: -------------------------------------------------------------------------------- 1 | # Orchestrating workflows with plans 2 | 3 | Plans are sets of tasks that can be combined with other logic. This allows you 4 | to do complex task operations, such as running multiple tasks with one command, 5 | computing values for the input for a task, or running certain tasks based on 6 | results of another task. You write plans in the Puppet language. And like tasks, 7 | plans are packaged in modules and can be shared on the Forge. -------------------------------------------------------------------------------- /lib/bolt_server/schemas/action-run_command.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "title": "run_command request", 4 | "description": "POST