Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
/spec/reports/
/spec/examples.txt
/spec/fixtures/configs/debug.log
/spec/fixtures/configs/empty/bolt-debug.log
/spec/fixtures/projects/local/bolt-debug.log
/spec/fixtures/projects/named/bolt-debug.log
/spec/fixtures/projects/embedded/Boltdir/bolt-debug.log
/test/tmp/
/test/version_tmp/
/tmp/
Expand Down Expand Up @@ -43,6 +47,7 @@ Gemfile.local
Boltdir/
bolt.yaml
project.yaml
bolt-debug.log

acceptance/hosts.yaml

Expand Down
4 changes: 3 additions & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ moduledir File.join(File.dirname(__FILE__), 'modules')

# Core modules used by 'apply'
mod 'puppetlabs-service', '3.1.0'
mod 'puppetlabs-puppet_agent', '4.25.0'
mod 'puppet-openvox_bootstrap',
git: 'https://github.com/austb/puppet-openvox_bootstrap.git',
ref: 'skip-if-installed'
mod 'puppetlabs-facts', '1.7.0'

# puppetlabs-puppet_agent deps
Expand Down
6 changes: 3 additions & 3 deletions bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
require 'bolt/logger'
require 'bolt/task'

# Installs the `puppet-agent` package on targets if needed, then collects facts,
# Installs the `openvox-agent` package on targets if needed, then collects facts,
# including any custom facts found in Bolt's module path. The package is
# installed using either the configured plugin or the `task` plugin with the
# `puppet_agent::install` task.
# `openvox_bootstrap::install` task.
#
# Agent installation will be skipped if the target includes the `puppet-agent`
# feature, either as a property of its transport (PCP) or by explicitly setting
# feature, either as a property of its transport or by explicitly setting
# it as a feature in Bolt's inventory.
#
# > **Note:** Not available in apply block
Expand Down
2 changes: 1 addition & 1 deletion bolt-modules/boltlib/lib/puppet/functions/get_resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The results are returned as a list of hashes representing each resource.
#
# Requires the Puppet Agent be installed on the target, which can be accomplished with apply_prep
# or by directly running the `puppet_agent::install` task. In order to be able to reference types without
# or by directly running the `openvox_bootstrap::install` task. In order to be able to reference types without
# string quoting (for example `get_resources($target, Package)` instead of `get_resources($target, 'Package')`),
# run the command `bolt puppetfile generate-types` to generate type references in `$Boldir/.resource_types`.
#
Expand Down
26 changes: 13 additions & 13 deletions bolt-modules/boltlib/spec/functions/apply_prep_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
let(:unknown_targets) { targets.reject { |target| target.protocol == 'pcp' } }
let(:fact) { { 'osfamily' => 'none' } }
let(:custom_facts_task) { Bolt::Task.new('custom_facts_task') }
let(:version_task) { Bolt::Task.new('puppet_agent::version') }
let(:install_task) { Bolt::Task.new('puppet_agent::install') }
let(:version_task) { Bolt::Task.new('openvox_bootstrap::check') }
let(:install_task) { Bolt::Task.new('openvox_bootstrap::install') }
let(:service_task) { Bolt::Task.new('service') }

before(:each) do
Expand All @@ -48,13 +48,13 @@
targets.each { |t| inventory.set_feature(t, 'puppet-agent', false) }

task1 = mock('version_task')
task1.stubs(:task_hash).returns('name' => 'puppet_agent::version')
task1.stubs(:task_hash).returns('name' => 'openvox_bootstrap::check')
task1.stubs(:runnable_with?).returns(true)
Puppet::Pal::ScriptCompiler.any_instance.stubs(:task_signature).with('puppet_agent::version').returns(task1)
Puppet::Pal::ScriptCompiler.any_instance.stubs(:task_signature).with('openvox_bootstrap::check').returns(task1)
task2 = mock('install_task')
task2.stubs(:task_hash).returns('name' => 'puppet_agent::install')
task2.stubs(:task_hash).returns('name' => 'openvox_bootstrap::install')
task2.stubs(:runnable_with?).returns(true)
Puppet::Pal::ScriptCompiler.any_instance.stubs(:task_signature).with('puppet_agent::install').returns(task2)
Puppet::Pal::ScriptCompiler.any_instance.stubs(:task_signature).with('openvox_bootstrap::install').returns(task2)
task3 = mock('service_task')
task3.stubs(:task_hash).returns('name' => 'service')
task3.stubs(:runnable_with?).returns(true)
Expand All @@ -69,7 +69,7 @@

plugins.expects(:get_hook)
.twice
.with("puppet_agent", :puppet_library)
.with("openvox_bootstrap", :puppet_library)
.returns(task_hook)

is_expected.to run.with_params(hostnames.join(','))
Expand All @@ -87,7 +87,7 @@

plugins.expects(:get_hook)
.twice
.with("puppet_agent", :puppet_library)
.with("openvox_bootstrap", :puppet_library)
.returns(task_hook)

is_expected.to run.with_params(hostnames, '_run_as' => 'root')
Expand All @@ -105,7 +105,7 @@

plugins.expects(:get_hook)
.twice
.with("puppet_agent", :puppet_library)
.with("openvox_bootstrap", :puppet_library)
.returns(task_hook)

is_expected.to run.with_params(hostnames, '_noop' => true)
Expand All @@ -125,7 +125,7 @@

plugins.expects(:get_hook)
.twice
.with("puppet_agent", :puppet_library)
.with("openvox_bootstrap", :puppet_library)
.returns(task_hook)

is_expected.to run.with_params(hostnames).and_raise_error(
Expand All @@ -142,7 +142,7 @@
'plugin_hooks' => {
'puppet_library' => {
'plugin' => 'task',
'task' => 'puppet_agent::install'
'task' => 'openvox_bootstrap::install'
}
}
}]
Expand Down Expand Up @@ -189,7 +189,7 @@
.returns(facts)

plugins.expects(:get_hook)
.with('puppet_agent', :puppet_library)
.with('openvox_bootstrap', :puppet_library)
.returns(task_hook)

is_expected.to run.with_params(hostname)
Expand Down Expand Up @@ -287,7 +287,7 @@
applicator.stubs(:custom_facts_task).returns(custom_facts_task)

plugins.expects(:get_hook)
.with("puppet_agent", :puppet_library)
.with("openvox_bootstrap", :puppet_library)
.returns(task_hook)
end

Expand Down
12 changes: 6 additions & 6 deletions documentation/applying_manifest_blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ Manifest blocks require facts to compile. When Bolt applies Puppet manifests, it
automatically installs the packages necessary to run the apply command and
gathers facts using [facter](https://puppet.com/docs/facter/latest/), making the
facts available to the manifest block. Bolt also identifies targets that do not
have Puppet agents and runs the [`puppet_agent::install`
task](https://forge.puppet.com/puppetlabs/puppet_agent) to install the agent.
have Puppet agents and runs the [`openvox_bootstrap::install`
task](https://forge.puppet.com/puppet/openvox_bootstrap) to install the agent.

> **Note:** Bolt installs the Puppet agent package to enable the use of Puppet
> **Note:** Bolt installs the OpenVox agent package to enable the use of Puppet
code. It does not require setting up a server-agent architecture between the
remote systems and the local system running Bolt.

Expand Down Expand Up @@ -240,7 +240,7 @@ access the `logs` key in the report hash:
plan example (
TargetSpec $targets
) {
# Install the puppet-agent package and gather facts
# Install the openvox-agent package and gather facts
$targets.apply_prep

# Apply Puppet code
Expand Down Expand Up @@ -400,7 +400,7 @@ Create a manifest that sets up a web server with nginx, and run it as a plan.
String $site_content = 'hello!',
) {

# Install the puppet-agent package if Puppet is not detected.
# Install the openvox-agent package if Puppet is not detected.
# Copy over custom facts from the Bolt modulepath.
# Run the `facter` command line tool to gather target information.
$targets.apply_prep
Expand Down Expand Up @@ -479,7 +479,7 @@ Create a manifest that sets up a web server with IIS and run it as a plan.
String $site_content = 'hello!',
) {

# Install the puppet-agent package if Puppet is not detected.
# Install the openvox-agent package if Puppet is not detected.
# Copy over custom facts from the Bolt modulepath.
# Run the `facter` command line tool to gather target information.
$targets.apply_prep
Expand Down
6 changes: 3 additions & 3 deletions documentation/bolt_inventory_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ level apply to all groups and targets in the inventory file.
- **Type:** Array

> 🔩 **Tip:** You can set the `puppet-agent` feature to indicate that Bolt
> should skip installing the Puppet agent on all targets when using
> should skip installing the OpenVox agent on all targets when using
> `bolt apply` or the `apply_prep` plan function.

```yaml
Expand Down Expand Up @@ -155,7 +155,7 @@ all groups and targets under the group.
- **Type:** Array

> 🔩 **Tip:** You can set the `puppet-agent` feature on the group to indicate
> that Bolt should skip installing the Puppet agent on all targets under the
> that Bolt should skip installing the OpenVox agent on all targets under the
> group when using `bolt apply` or the `apply_prep` plan function.

```yaml
Expand Down Expand Up @@ -316,7 +316,7 @@ A list of available features for the target.
- **Type:** Array

> 🔩 **Tip:** You can set the `puppet-agent` feature on the target to indicate
> that Bolt should skip installing the Puppet agent on the target when using
> that Bolt should skip installing the OpenVox agent on the target when using
> `bolt apply` or the `apply_prep` plan function.

```yaml
Expand Down
4 changes: 3 additions & 1 deletion lib/bolt/config/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,12 @@ module Options
_example: ["myproject", "myproject::foo", "myproject::bar", "myproject::deploy::*"]
},
"plugin-hooks" => {
# rubocop:disable Layout/LineLength
description: "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. " \
"The only configurable plugin hook is `puppet_library`, which can use two possible plugins: " \
"[`puppet_agent`](https://github.com/puppetlabs/puppetlabs-puppet_agent#puppet_agentinstall) " \
"[`openvox_bootstrap`](https://github.com/voxpupuli/puppet-openvox_bootstrap#openvox_boostrapinstall) " \
"and [`task`](using_plugins.md#task).",
# rubocop:enable Layout/LineLength
type: Hash,
_plugin: true,
_example: { "puppet_library" => { "plugin" => "puppet_agent", "version" => "6.15.0", "_run_as" => "root" } }
Expand Down
2 changes: 1 addition & 1 deletion lib/bolt/pal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ def plan_hierarchy_lookup(key, plan_vars: {})
end

def lookup(key, targets, inventory, executor, plan_vars: {})
# Install the puppet-agent package and collect facts. Facts are
# Install the openvox-agent package and collect facts. Facts are
# automatically added to the targets.
in_plan_compiler(executor, inventory, nil) do |compiler|
compiler.call_function('apply_prep', targets)
Expand Down
2 changes: 1 addition & 1 deletion lib/bolt/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def boltdir
RUBY_PLUGINS = %w[task prompt env_var puppetdb puppet_connect_data].freeze
BUILTIN_PLUGINS = %w[task terraform pkcs7 prompt vault aws_inventory puppetdb azure_inventory
yaml env_var gcloud_inventory].freeze
DEFAULT_PLUGIN_HOOKS = { 'puppet_library' => { 'plugin' => 'puppet_agent', 'stop_service' => true } }.freeze
DEFAULT_PLUGIN_HOOKS = { 'puppet_library' => { 'plugin' => 'openvox_bootstrap', 'stop_service' => true } }.freeze

attr_reader :pal, :plugin_context
attr_writer :plugin_hooks
Expand Down
6 changes: 3 additions & 3 deletions pwsh_module/command.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ Describe "test all bolt command examples" {
$result = Get-BoltModule
$result | Should -Be 'bolt module show'
}
It "bolt module show puppet_agent" {
$result = Get-BoltModule -Name 'puppet_agent'
$result | Should -Be 'bolt module show puppet_agent'
It "bolt module show openvox_bootstrap" {
$result = Get-BoltModule -Name 'openvox_bootstrap'
$result | Should -Be 'bolt module show openvox_bootstrap'
}
}

Expand Down
17 changes: 13 additions & 4 deletions rakelib/docs.rake
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,22 @@ begin
end

@local_modules = parser.local_modules.sort.map do |mod|
readme = make_request("https://raw.githubusercontent.com/puppetlabs/bolt/main/modules/#{mod.first}/README.md")
match = readme.match(/## Description(?<desc>.*)## Req/m)
# r10k puts git hosted modules under @local_modules,
# handle the ones with local: true as truely local
if mod[1][:local]
readme = make_request("https://raw.githubusercontent.com/puppetlabs/bolt/main/modules/#{mod.first}/README.md")
match = readme.match(/## Description(?<desc>.*)## Req/m)
description = match[:desc].strip
url = "https://github.com/puppetlabs/bolt/tree/main/modules/#{mod.first}"
else
description = 'See git repo for details'
url = mod[1][:git] || ''
end

{
name: mod.first,
description: match[:desc].strip,
url: "https://github.com/puppetlabs/bolt/tree/main/modules/#{mod.first}"
description: description,
url: url
}
end

Expand Down
2 changes: 1 addition & 1 deletion schemas/bolt-defaults.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
}
},
"plugin-hooks": {
"description": "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. The only configurable plugin hook is `puppet_library`, which can use two possible plugins: [`puppet_agent`](https://github.com/puppetlabs/puppetlabs-puppet_agent#puppet_agentinstall) and [`task`](using_plugins.md#task).",
"description": "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. The only configurable plugin hook is `puppet_library`, which can use two possible plugins: [`openvox_bootstrap`](https://github.com/voxpupuli/puppet-openvox_bootstrap#openvox_boostrapinstall) and [`task`](using_plugins.md#task).",
"oneOf": [
{
"type": "object"
Expand Down
2 changes: 1 addition & 1 deletion schemas/bolt-project.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@
}
},
"plugin-hooks": {
"description": "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. The only configurable plugin hook is `puppet_library`, which can use two possible plugins: [`puppet_agent`](https://github.com/puppetlabs/puppetlabs-puppet_agent#puppet_agentinstall) and [`task`](using_plugins.md#task).",
"description": "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. The only configurable plugin hook is `puppet_library`, which can use two possible plugins: [`openvox_bootstrap`](https://github.com/voxpupuli/puppet-openvox_bootstrap#openvox_boostrapinstall) and [`task`](using_plugins.md#task).",
"oneOf": [
{
"type": "object"
Expand Down
6 changes: 3 additions & 3 deletions spec/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ ENV LANGUAGE=en_US.UTF-8
# Install the puppet-agent package
# sudo is important here so puppet is added to the path
RUN if [ -n "$PUPPET_COLLECTION" ]; then \
wget -q https://apt.puppetlabs.com/${PUPPET_COLLECTION}-release-bionic.deb \
&& sudo dpkg -i ${PUPPET_COLLECTION}-release-bionic.deb \
wget -q https://apt.voxpupuli.org/${PUPPET_COLLECTION}-release-ubuntu18.04.deb \
&& sudo dpkg -i ${PUPPET_COLLECTION}-release-ubuntu18.04.deb \
&& sudo apt-get update \
&& sudo apt-get -y install puppet-agent ; \
&& sudo apt-get -y install openvox-agent ; \
fi

# Add 'bolt' user
Expand Down
13 changes: 6 additions & 7 deletions spec/bolt_spec/run_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
end
end

context 'with a target that has a puppet-agent installed' do
context 'with a target that has a openvox-agent installed' do
def root_config
{ 'ssh' => {
'run-as' => 'root',
Expand All @@ -115,16 +115,15 @@ def root_config
end

before(:all) do
result = run_task('puppet_agent::version', 'ssh', {}, inventory: conn_inventory, config: root_config)
expect(result.first['status']).to eq('success')
unless result.first['value']['version']
result = run_task('puppet_agent::install', 'ssh', {}, inventory: conn_inventory, config: root_config)
result = run_task('openvox_bootstrap::check', 'ssh', {}, inventory: conn_inventory, config: root_config)
if result.first['status'] != 'success'
result = run_task('openvox_bootstrap::install', 'ssh', {}, inventory: conn_inventory, config: root_config)
expect(result.first['status']).to eq('success')
end
expect(result.first['status']).to eq('success')
end

after(:all) do
uninstall = '/opt/puppetlabs/bin/puppet resource package puppet-agent ensure=absent'
uninstall = '/opt/puppetlabs/bin/puppet resource package openvox-agent ensure=absent'
run_command(uninstall, 'ssh', inventory: conn_inventory, config: root_config)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
build:
context: .
args:
PUPPET_COLLECTION: puppet7
PUPPET_COLLECTION: openvox7
container_name: puppet_7_node
ports:
- "20025:22"
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/apply_error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let(:tflags) { %w[--no-host-key-check] }

it 'prints a helpful error if Puppet is not present' do
uninstall = '/opt/puppetlabs/bin/puppet resource package puppet-agent ensure=absent'
uninstall = '/opt/puppetlabs/bin/puppet resource package openvox-agent ensure=absent'
run_cli_json(%W[command run #{uninstall} --run-as root --sudo-password #{password}] + config_flags)

result = run_cli_json(%w[plan run basic::class] + config_flags)
Expand Down Expand Up @@ -53,7 +53,7 @@
let(:password) { conn_info('winrm')[:password] }
let(:tflags) { %w[--no-ssl --no-ssl-verify] }

it 'prints a helpful error if Puppet is not present', :winrm_agentless, :winrm do

Check warning on line 56 in spec/integration/apply_error_spec.rb

View workflow job for this annotation

GitHub Actions / Windows Agentless (3.3)

errors gracefully attempting to apply a manifest block over winrm prints a helpful error if Puppet is not present Skipped: Skipping this test as it fails with a connection error until #3001 is fixed

Check warning on line 56 in spec/integration/apply_error_spec.rb

View workflow job for this annotation

GitHub Actions / Windows Agentless (3.2)

errors gracefully attempting to apply a manifest block over winrm prints a helpful error if Puppet is not present Skipped: Skipping this test as it fails with a connection error until #3001 is fixed

Check warning on line 56 in spec/integration/apply_error_spec.rb

View workflow job for this annotation

GitHub Actions / Windows Agentless (3.4)

errors gracefully attempting to apply a manifest block over winrm prints a helpful error if Puppet is not present Skipped: Skipping this test as it fails with a connection error until #3001 is fixed
skip "Skipping this test as it fails with a connection error until #3001 is fixed"
result = run_cli_json(%w[plan run basic::class] + config_flags)
error = result['details']['result_set'][0]['value']['_error']
Expand Down
Loading
Loading