vagrant-bolt 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/spec.yml +71 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -8
- data/CHANGELOG.md +65 -4
- data/Gemfile +5 -4
- data/README.md +33 -18
- data/acceptance/components/bolt_spec.rb +27 -28
- data/acceptance/skeletons/advanced/Vagrantfile +2 -2
- data/acceptance/skeletons/base/Puppetfile +2 -0
- data/acceptance/skeletons/base/Vagrantfile +2 -1
- data/acceptance/skeletons/provisioner/Vagrantfile +1 -1
- data/acceptance/skeletons/trigger/Vagrantfile +1 -1
- data/acceptance/vagrant-spec.config.rb +3 -3
- data/lib/vagrant-bolt/command.rb +6 -6
- data/lib/vagrant-bolt/config/bolt.rb +31 -22
- data/lib/vagrant-bolt/config/global.rb +30 -3
- data/lib/vagrant-bolt/config_builder/config.rb +35 -5
- data/lib/vagrant-bolt/config_builder/monkey_patches.rb +2 -1
- data/lib/vagrant-bolt/config_builder/provisioner.rb +28 -4
- data/lib/vagrant-bolt/runner.rb +10 -10
- data/lib/vagrant-bolt/util/bolt.rb +7 -6
- data/lib/vagrant-bolt/util/config.rb +3 -2
- data/lib/vagrant-bolt/util/machine.rb +4 -3
- data/lib/vagrant-bolt/version.rb +1 -1
- data/spec/unit/config/bolt_spec.rb +8 -1
- data/spec/unit/config/global_spec.rb +9 -3
- data/spec/unit/runner/runner_spec.rb +37 -11
- data/spec/unit/util/bolt_spec.rb +25 -6
- data/tasks/changelog.rake +1 -1
- metadata +9 -26
- data/.travis.yml +0 -28
- data/acceptance/skeletons/base/modules/facts/CHANGELOG.md +0 -26
- data/acceptance/skeletons/base/modules/facts/CONTRIBUTING.md +0 -279
- data/acceptance/skeletons/base/modules/facts/Gemfile +0 -98
- data/acceptance/skeletons/base/modules/facts/LICENSE +0 -201
- data/acceptance/skeletons/base/modules/facts/README.md +0 -45
- data/acceptance/skeletons/base/modules/facts/Rakefile +0 -8
- data/acceptance/skeletons/base/modules/facts/checksums.json +0 -42
- data/acceptance/skeletons/base/modules/facts/lib/puppet/functions/facts/group_by.rb +0 -14
- data/acceptance/skeletons/base/modules/facts/metadata.json +0 -62
- data/acceptance/skeletons/base/modules/facts/plans/info.pp +0 -16
- data/acceptance/skeletons/base/modules/facts/plans/init.pp +0 -13
- data/acceptance/skeletons/base/modules/facts/tasks/bash.json +0 -5
- data/acceptance/skeletons/base/modules/facts/tasks/bash.sh +0 -93
- data/acceptance/skeletons/base/modules/facts/tasks/init.json +0 -10
- data/acceptance/skeletons/base/modules/facts/tasks/powershell.json +0 -4
- data/acceptance/skeletons/base/modules/facts/tasks/powershell.ps1 +0 -56
- data/acceptance/skeletons/base/modules/facts/tasks/ruby.json +0 -4
- data/acceptance/skeletons/base/modules/facts/tasks/ruby.rb +0 -40
@@ -1,45 +0,0 @@
|
|
1
|
-
# facts
|
2
|
-
|
3
|
-
#### Table of Contents
|
4
|
-
|
5
|
-
1. [Description](#description)
|
6
|
-
2. [Requirements](#requirements)
|
7
|
-
3. [Usage](#usage)
|
8
|
-
4. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
|
9
|
-
|
10
|
-
## Description
|
11
|
-
|
12
|
-
This module provides a collection of facts tasks and plans all of which retrieve facts from the specified nodes but each of them processes the retrieved facts differently. The provided plans are:
|
13
|
-
* `facts` - retrieves the facts and then stores them in the inventory, returns a result set wrapping result objects for each specified node which in turn wrap the retrieved facts
|
14
|
-
* `facts::info` - retrieves the facts and returns information about each node's OS compiled from the `os` fact value retrieved from that node
|
15
|
-
|
16
|
-
The provided tasks:
|
17
|
-
* `facts` - retrieves the facts and without further processing returns a result set wrapping result objects for each specified node which in turn wrap the retrieved facts (this task is used by the above plans). This task relies on cross-platform task support; if unavailable, the individual implementations can be used instead.
|
18
|
-
* `facts::bash` - bash implementation of fact gathering, used by the `facts` task.
|
19
|
-
* `facts::powershell` - powershell implementation of fact gathering, used by the `facts` task.
|
20
|
-
* `facts::ruby` - ruby implementation of fact gathering, used by the `facts` task.
|
21
|
-
|
22
|
-
## Requirements
|
23
|
-
|
24
|
-
This module is compatible with the version of Puppet Bolt it ships with.
|
25
|
-
|
26
|
-
## Usage
|
27
|
-
|
28
|
-
To run the facts plan run
|
29
|
-
|
30
|
-
```
|
31
|
-
bolt plan run facts --nodes node1.example.com,node2.example.com
|
32
|
-
```
|
33
|
-
|
34
|
-
### Parameters
|
35
|
-
|
36
|
-
All plans have only one parameter:
|
37
|
-
|
38
|
-
* **nodes** - The nodes to retrieve the facts from.
|
39
|
-
|
40
|
-
## Reference
|
41
|
-
|
42
|
-
The core functionality is implemented in the `facts` task, which provides implementations
|
43
|
-
for the `shell`, `powershell`, and `puppet-agent` features. The tasks run `facter --json`
|
44
|
-
if facter is available on the target or - as a fallback - compile and return information
|
45
|
-
mimicking that provided by facter's `os` fact.
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'puppetlabs_spec_helper/rake_tasks'
|
4
|
-
require 'puppet-syntax/tasks/puppet-syntax'
|
5
|
-
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
|
6
|
-
require 'puppet-lint/tasks/puppet-lint'
|
7
|
-
|
8
|
-
PuppetLint.configuration.send('disable_relative')
|
@@ -1,42 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"CHANGELOG.md": "38df9dfb5726e77f9db80adfb22f9eac",
|
3
|
-
"CONTRIBUTING.md": "f4016d06deb58c557a3b9da1197e06e7",
|
4
|
-
"Gemfile": "ab85e3e87ea316ff44bc9208534adc69",
|
5
|
-
"LICENSE": "86d3f3a95c324c9479bd8986968f4327",
|
6
|
-
"README.md": "a1cd11b63dfffaa41c08021bbf96d6ef",
|
7
|
-
"Rakefile": "bff4086985f50ba3c169cdd409cd4142",
|
8
|
-
"lib/puppet/functions/facts/group_by.rb": "684c78363ea8d4eccf49098dd6132c8f",
|
9
|
-
"metadata.json": "98db2b1f8b476f9c57ab719a2e4758ce",
|
10
|
-
"plans/info.pp": "7b0f3ea1993c1276aa23d56958c3137e",
|
11
|
-
"plans/init.pp": "f91b3e648da866edd43640f71f81187c",
|
12
|
-
"spec/acceptance/init_spec.rb": "9b515c8706e73e358c803096b2a63f40",
|
13
|
-
"spec/acceptance/nodesets/centos-7-x64.yml": "a713f3abd3657f0ae2878829badd23cd",
|
14
|
-
"spec/acceptance/nodesets/centos7-pooler.yml": "1c7cf0da5f81343715acf56b1ee03355",
|
15
|
-
"spec/acceptance/nodesets/debian-8-x64.yml": "d2d2977900989f30086ad251a14a1f39",
|
16
|
-
"spec/acceptance/nodesets/default.yml": "549c468454650afa7e510d09fa9edb1e",
|
17
|
-
"spec/acceptance/nodesets/docker/centos-7.yml": "8a3892807bdd62306ae4774f41ba11ae",
|
18
|
-
"spec/acceptance/nodesets/docker/debian-8.yml": "ac8e871d1068c96de5e85a89daaec6df",
|
19
|
-
"spec/acceptance/nodesets/docker/ubuntu-14.04.yml": "dc42ee922a96908d85b8f0f08203ce58",
|
20
|
-
"spec/acceptance/nodesets/windows32-pooler.yml": "a78222e3b0c022664f4b61a803a79f78",
|
21
|
-
"spec/default_facts.yml": "4de3cb611af6981a6d22bc77d7dd6f6f",
|
22
|
-
"spec/fixtures/configs/empty.yml": "6105347ebb9825ac754615ca55ff3b0c",
|
23
|
-
"spec/fixtures/configs/invalid.yml": "1f2aaef07c9e9ab52497f0e8a9bb7149",
|
24
|
-
"spec/fixtures/configs/puppetdb.yml": "3be9bcf5919b82e2050590c1c311880e",
|
25
|
-
"spec/fixtures/inventory/empty.yml": "6105347ebb9825ac754615ca55ff3b0c",
|
26
|
-
"spec/fixtures/inventory/invalid.yml": "1f2aaef07c9e9ab52497f0e8a9bb7149",
|
27
|
-
"spec/fixtures/keys/id_rsa": "4d4567b6a8116b736e4294726b9df071",
|
28
|
-
"spec/fixtures/keys/id_rsa.pub": "f298f0901636a877ef84b1fedb75fb9f",
|
29
|
-
"spec/fixtures/scripts/success.sh": "0a08b835341133f7738cc32e3cd43c6c",
|
30
|
-
"spec/functions/group_by_spec.rb": "dd60e20a61bfcfb16d5023027d7435c6",
|
31
|
-
"spec/plans/info_spec.rb": "0cef33fc100eb4457b233d9d6b163dfb",
|
32
|
-
"spec/plans/init_spec.rb": "1b85a1a4cae4b1274975ffb4f915e20f",
|
33
|
-
"spec/spec_helper.rb": "2a69ebf9ece229e56657bfcd827a42a5",
|
34
|
-
"spec/spec_helper_acceptance.rb": "284e24db3e4b739fe14fada7809378a8",
|
35
|
-
"tasks/bash.json": "ba2b85269632c30a8022132c8cd52e9a",
|
36
|
-
"tasks/bash.sh": "cd4c27d6d5bee7fda7f4f64e4ad50044",
|
37
|
-
"tasks/init.json": "7fd933a5fe813889ccf1f8efd024c98e",
|
38
|
-
"tasks/powershell.json": "eed5ef9bd7f6c6a83361ec3b51346d36",
|
39
|
-
"tasks/powershell.ps1": "9125c59f9961743e3c0c175c9e6189f0",
|
40
|
-
"tasks/ruby.json": "4f3314365d1d1760bdaa6e5ddd90eb16",
|
41
|
-
"tasks/ruby.rb": "43c98c7024fb0c72ca7229ca96c810fb"
|
42
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# A simple wrapper of the ruby's group_by function.
|
4
|
-
Puppet::Functions.create_function(:'facts::group_by') do
|
5
|
-
dispatch :native_group_by do
|
6
|
-
param 'Iterable', :collection
|
7
|
-
block_param
|
8
|
-
return_type 'Hash'
|
9
|
-
end
|
10
|
-
|
11
|
-
def native_group_by(collection, &block)
|
12
|
-
collection.group_by(&block)
|
13
|
-
end
|
14
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "puppetlabs-facts",
|
3
|
-
"version": "0.3.1",
|
4
|
-
"author": "puppet",
|
5
|
-
"summary": "Tasks that inspect the value of system facts",
|
6
|
-
"license": "Apache-2.0",
|
7
|
-
"source": "https://github.com/puppetlabs/puppetlabs-facts",
|
8
|
-
"project_page": "https://github.com/puppetlabs/puppetlabs-facts",
|
9
|
-
"issues_url": "https://github.com/puppetlabs/puppetlabs-facts/issues",
|
10
|
-
"dependencies": [
|
11
|
-
|
12
|
-
],
|
13
|
-
"data_provider": null,
|
14
|
-
"operatingsystem_support": [
|
15
|
-
{
|
16
|
-
"operatingsystem": "Debian",
|
17
|
-
"operatingsystemrelease": [
|
18
|
-
"8",
|
19
|
-
"9"
|
20
|
-
]
|
21
|
-
},
|
22
|
-
{
|
23
|
-
"operatingsystem": "RedHat",
|
24
|
-
"operatingsystemrelease": [
|
25
|
-
"6",
|
26
|
-
"7"
|
27
|
-
]
|
28
|
-
},
|
29
|
-
{
|
30
|
-
"operatingsystem": "Ubuntu",
|
31
|
-
"operatingsystemrelease": [
|
32
|
-
"16.04",
|
33
|
-
"18.04"
|
34
|
-
]
|
35
|
-
},
|
36
|
-
{
|
37
|
-
"operatingsystem": "windows",
|
38
|
-
"operatingsystemrelease": [
|
39
|
-
"Server 2012 R2",
|
40
|
-
"Server 2016",
|
41
|
-
"10"
|
42
|
-
]
|
43
|
-
},
|
44
|
-
{
|
45
|
-
"operatingsystem": "OSX",
|
46
|
-
"operatingsystemrelease": [
|
47
|
-
"10.12",
|
48
|
-
"10.13"
|
49
|
-
]
|
50
|
-
}
|
51
|
-
],
|
52
|
-
"requirements": [
|
53
|
-
{
|
54
|
-
"name": "puppet",
|
55
|
-
"version_requirement": ">= 5.1.0 < 7.0.0"
|
56
|
-
}
|
57
|
-
],
|
58
|
-
"description": "Tasks that inspect the value of system facts",
|
59
|
-
"pdk-version": "1.5.0",
|
60
|
-
"template-url": "https://github.com/puppetlabs/pdk-templates",
|
61
|
-
"template-ref": "heads/master-0-g34e3266"
|
62
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# A plan that prints basic OS information for the specified nodes. It first
|
2
|
-
# runs the facts task to retrieve facts from the nodes, then compiles the
|
3
|
-
# desired OS information from the os fact value of each nodes.
|
4
|
-
#
|
5
|
-
# The $nodes parameter is a list of the nodes for which to print the OS
|
6
|
-
# information. This plan primarily provides readable formatting, and ignores
|
7
|
-
# nodes that error.
|
8
|
-
plan facts::info(TargetSpec $nodes) {
|
9
|
-
return run_task('facts', $nodes, '_catch_errors' => true).reduce([]) |$info, $r| {
|
10
|
-
if ($r.ok) {
|
11
|
-
$info + "${r.target.name}: ${r[os][name]} ${r[os][release][full]} (${r[os][family]})"
|
12
|
-
} else {
|
13
|
-
$info # don't include any info for nodes which failed
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# A plan that retrieves facts and stores in the inventory for the
|
2
|
-
# specified nodes.
|
3
|
-
#
|
4
|
-
# The $nodes parameter is a list of nodes to retrieve the facts for.
|
5
|
-
plan facts(TargetSpec $nodes) {
|
6
|
-
$result_set = run_task('facts', $nodes)
|
7
|
-
|
8
|
-
$result_set.each |$result| {
|
9
|
-
add_facts($result.target, $result.value)
|
10
|
-
}
|
11
|
-
|
12
|
-
return $result_set
|
13
|
-
}
|
@@ -1,93 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# Delegate to facter if available
|
4
|
-
export PATH="$PATH:/opt/puppetlabs/bin"
|
5
|
-
command -v facter > /dev/null 2>&1 && exec facter -p --json --show-legacy
|
6
|
-
|
7
|
-
minor () {
|
8
|
-
minor="${*#*.}"
|
9
|
-
[ "$minor" == "$*" ] || echo "${minor%%.*}"
|
10
|
-
}
|
11
|
-
|
12
|
-
# Determine the OS name
|
13
|
-
if [ -f /etc/redhat-release ]; then
|
14
|
-
if egrep -iq centos /etc/redhat-release; then
|
15
|
-
name=CentOS
|
16
|
-
elif egrep -iq 'Fedora release' /etc/redhat-release; then
|
17
|
-
name=Fedora
|
18
|
-
fi
|
19
|
-
release=$(sed -r -e 's/^.* release ([0-9]+(\.[0-9]+)?).*$/\1/' \
|
20
|
-
/etc/redhat-release)
|
21
|
-
fi
|
22
|
-
|
23
|
-
if [ -z "${name}" ]; then
|
24
|
-
LSB_RELEASE=$(command -v lsb_release)
|
25
|
-
if [ -n "$LSB_RELEASE" ]; then
|
26
|
-
if [ -z "$name" ]; then
|
27
|
-
name=$($LSB_RELEASE -i | sed -re 's/^.*:[ \t]*//')
|
28
|
-
fi
|
29
|
-
release=$($LSB_RELEASE -r | sed -re 's/^.*:[ \t]*//')
|
30
|
-
fi
|
31
|
-
fi
|
32
|
-
|
33
|
-
# if lsb not available try os-release
|
34
|
-
if [ -z "${name}" ]; then
|
35
|
-
if [ -e /etc/os-release ]; then
|
36
|
-
name=$(grep "^NAME" /etc/os-release | cut -d'=' -f2 | sed "s/\"//g")
|
37
|
-
release=$(grep "^VERSION_ID" /etc/os-release | cut -d'=' -f2 | sed "s/\"//g")
|
38
|
-
elif [-e /usr/lib/os-release ]; then
|
39
|
-
name=$(grep "^NAME" /usr/lib/os-release | cut -d'=' -f2 | sed "s/\"//g")
|
40
|
-
release=$(grep "^VERSION_ID" /usr/lib/os-release | cut -d'=' -f2 | sed "s/\"//g")
|
41
|
-
fi
|
42
|
-
if [ -n "${name}" ]; then
|
43
|
-
if echo "${name}" | egrep -iq "(.*red)(.*hat)"; then
|
44
|
-
name="RedHat"
|
45
|
-
elif echo "${name}" | egrep -iq "debian"; then
|
46
|
-
name="Debian"
|
47
|
-
fi
|
48
|
-
fi
|
49
|
-
fi
|
50
|
-
|
51
|
-
if [ -z "${name}" ]; then
|
52
|
-
name=$(uname)
|
53
|
-
release=$(uname -r)
|
54
|
-
fi
|
55
|
-
|
56
|
-
case $name in
|
57
|
-
RedHat|Fedora|CentOS|Scientific|SLC|Ascendos|CloudLinux)
|
58
|
-
family=RedHat;;
|
59
|
-
HuaweiOS|LinuxMint|Ubuntu|Debian)
|
60
|
-
family=Debian;;
|
61
|
-
*)
|
62
|
-
family=$name;;
|
63
|
-
esac
|
64
|
-
|
65
|
-
# Print it all out
|
66
|
-
if [ -z "$name" ]; then
|
67
|
-
cat <<JSON
|
68
|
-
{
|
69
|
-
"_error": {
|
70
|
-
"kind": "facts/noname",
|
71
|
-
"msg": "Could not determine OS name"
|
72
|
-
}
|
73
|
-
}
|
74
|
-
JSON
|
75
|
-
else
|
76
|
-
cat <<JSON
|
77
|
-
{
|
78
|
-
"os": {
|
79
|
-
"name": "${name}",
|
80
|
-
JSON
|
81
|
-
[ -n "$release" ] && cat <<JSON
|
82
|
-
"release": {
|
83
|
-
"full": "${release}",
|
84
|
-
"major": "${release%%.*}",
|
85
|
-
"minor": "`minor "${release}"`"
|
86
|
-
},
|
87
|
-
JSON
|
88
|
-
cat <<JSON
|
89
|
-
"family": "${family}"
|
90
|
-
}
|
91
|
-
}
|
92
|
-
JSON
|
93
|
-
fi
|
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"description": "Gather system facts",
|
3
|
-
"parameters": {},
|
4
|
-
"input_method": "environment",
|
5
|
-
"implementations": [
|
6
|
-
{"name": "ruby.rb", "requirements": ["puppet-agent"]},
|
7
|
-
{"name": "powershell.ps1", "requirements": ["powershell"]},
|
8
|
-
{"name": "bash.sh", "requirements": ["shell"]}
|
9
|
-
]
|
10
|
-
}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
#!powershell.exe
|
2
|
-
|
3
|
-
# Delegate to facter if available
|
4
|
-
if (Get-Command facter -ErrorAction SilentlyContinue) {
|
5
|
-
facter -p --json --show-legacy
|
6
|
-
}
|
7
|
-
else {
|
8
|
-
# The number 2 in the condition below is the value of
|
9
|
-
# the [System.PlatformID]::Win32NT constant. We don't
|
10
|
-
# use the constant here as it doesn't work on Windows
|
11
|
-
# Server Core.
|
12
|
-
if ([System.Environment]::OSVersion.Platform -gt 2) {
|
13
|
-
@'
|
14
|
-
{
|
15
|
-
"_error": {
|
16
|
-
"kind": "facts/noname",
|
17
|
-
"msg": "Could not determine OS name"
|
18
|
-
}
|
19
|
-
}
|
20
|
-
'@
|
21
|
-
}
|
22
|
-
else {
|
23
|
-
$release = [System.Environment]::OSVersion.Version.ToString() -replace '\.[^.]*\z'
|
24
|
-
$version = $release -replace '\.[^.]*\z'
|
25
|
-
|
26
|
-
# This fails for regular users unless explicitly enabled
|
27
|
-
$os = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
|
28
|
-
$consumerrel = $os.ProductType -eq '1'
|
29
|
-
|
30
|
-
$release = switch($version){
|
31
|
-
'10.0'{ if ($consumerrel) { '10' } else { '2016' } }
|
32
|
-
'6.3' { if ($consumerrel) { '8.1' } else { '2012 R2' } }
|
33
|
-
'6.2' { if ($consumerrel) { '8' } else { '2012' } }
|
34
|
-
'6.1' { if ($consumerrel) { '7' } else { '2008 R2' } }
|
35
|
-
'6.0' { if ($consumerrel) { 'Vista' } else { '2008' } }
|
36
|
-
'5.2' {
|
37
|
-
if ($consumerrel) { 'XP' } else {
|
38
|
-
if ($os.OtherTypeDescription -eq 'R2') { '2003 R2' } else { '2003' }
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
@"
|
44
|
-
{
|
45
|
-
"os": {
|
46
|
-
"name": "windows",
|
47
|
-
"release": {
|
48
|
-
"full": "$release",
|
49
|
-
"major": "$release"
|
50
|
-
},
|
51
|
-
"family": "windows"
|
52
|
-
}
|
53
|
-
}
|
54
|
-
"@
|
55
|
-
}
|
56
|
-
}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
def facter_executable
|
5
|
-
if Gem.win_platform?
|
6
|
-
require 'win32/registry'
|
7
|
-
installed_dir =
|
8
|
-
begin
|
9
|
-
Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Puppet Labs\Puppet') do |reg|
|
10
|
-
# rubocop:disable Style/RescueModifier
|
11
|
-
# Rescue missing key
|
12
|
-
dir = reg['RememberedInstallDir64'] rescue ''
|
13
|
-
# Both keys may exist, make sure the dir exists
|
14
|
-
break dir if File.exist?(dir)
|
15
|
-
|
16
|
-
# Rescue missing key
|
17
|
-
reg['RememberedInstallDir'] rescue ''
|
18
|
-
# rubocop:enable Style/RescueModifier
|
19
|
-
end
|
20
|
-
rescue Win32::Registry::Error
|
21
|
-
# Rescue missing registry path
|
22
|
-
''
|
23
|
-
end
|
24
|
-
|
25
|
-
facter =
|
26
|
-
if installed_dir.empty?
|
27
|
-
''
|
28
|
-
else
|
29
|
-
File.join(installed_dir, 'bin', 'facter')
|
30
|
-
end
|
31
|
-
else
|
32
|
-
facter = '/opt/puppetlabs/puppet/bin/facter'
|
33
|
-
end
|
34
|
-
|
35
|
-
# Fall back to PATH lookup if puppet-agent isn't installed
|
36
|
-
File.exist?(facter) ? facter : 'facter'
|
37
|
-
end
|
38
|
-
|
39
|
-
# Delegate to facter
|
40
|
-
exec(facter_executable, '-p', '--json', '--show-legacy')
|