puppet-ghostbuster 2.0.0 → 2.2.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/labeler.yml +3 -0
- data/.github/release.yml +40 -0
- data/.github/workflows/labeler.yml +18 -0
- data/.github/workflows/release.yml +7 -7
- data/.github/workflows/test.yml +22 -13
- data/CHANGELOG.md +28 -4
- data/Gemfile +4 -2
- data/README.md +8 -1
- data/Rakefile +1 -1
- data/lib/puppet-ghostbuster/puppetdb.rb +9 -4
- data/lib/puppet-ghostbuster/version.rb +1 -1
- data/puppet-ghostbuster.gemspec +5 -5
- data/spec/puppet_ghostbuster/puppet_db_spec.rb +56 -0
- data/spec/spec_helper.rb +2 -0
- metadata +24 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ded6aa277f38f2383a92a014237dfcf53e4c5d08b9a31ddca68c04a1ba9d5a0
|
|
4
|
+
data.tar.gz: 9bc03b84ae579a7d1c0c8087d19dcf1f9a096882e261126941b333f43bfc49df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9626a929c8fa55a70ab0600dc807f83db204bcc23d4f9db39c9cd5eda4fe55fd93c6dc03e8eae680dba8ad678cfc1a2e8e031cdb2eb49e70d0815dc89b6831ef
|
|
7
|
+
data.tar.gz: 8c664c1ecd7d405319f6567646104d7f7d9c96f47a17dd4049d7d1a1285999e5682c432e4fccfb121fa495e56147e3ae158079c4b479ece41f8831a301c3198e
|
data/.github/labeler.yml
ADDED
data/.github/release.yml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
|
|
3
|
+
|
|
4
|
+
changelog:
|
|
5
|
+
exclude:
|
|
6
|
+
labels:
|
|
7
|
+
- duplicate
|
|
8
|
+
- invalid
|
|
9
|
+
- modulesync
|
|
10
|
+
- question
|
|
11
|
+
- skip-changelog
|
|
12
|
+
- wont-fix
|
|
13
|
+
- wontfix
|
|
14
|
+
- github_actions
|
|
15
|
+
|
|
16
|
+
categories:
|
|
17
|
+
- title: Breaking Changes 🛠
|
|
18
|
+
labels:
|
|
19
|
+
- backwards-incompatible
|
|
20
|
+
|
|
21
|
+
- title: New Features 🎉
|
|
22
|
+
labels:
|
|
23
|
+
- enhancement
|
|
24
|
+
|
|
25
|
+
- title: Bug Fixes 🐛
|
|
26
|
+
labels:
|
|
27
|
+
- bug
|
|
28
|
+
|
|
29
|
+
- title: Documentation Updates 📚
|
|
30
|
+
labels:
|
|
31
|
+
- documentation
|
|
32
|
+
- docs
|
|
33
|
+
|
|
34
|
+
- title: Dependency Updates ⬆️
|
|
35
|
+
labels:
|
|
36
|
+
- dependencies
|
|
37
|
+
|
|
38
|
+
- title: Other Changes
|
|
39
|
+
labels:
|
|
40
|
+
- "*"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 🏷️ Pull Request Labeler
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
- pull_request_target
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
labeler:
|
|
12
|
+
name: Labeler
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
if: github.repository_owner == 'voxpupuli' || github.repository_owner == 'OpenVoxProject'
|
|
15
|
+
permissions:
|
|
16
|
+
pull-requests: write
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
name: Build the gem
|
|
16
16
|
runs-on: ubuntu-24.04
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
19
|
- name: Install Ruby
|
|
20
20
|
uses: ruby/setup-ruby@v1
|
|
21
21
|
with:
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
shell: bash
|
|
25
25
|
run: gem build --verbose *.gemspec
|
|
26
26
|
- name: Upload gem to GitHub cache
|
|
27
|
-
uses: actions/upload-artifact@
|
|
27
|
+
uses: actions/upload-artifact@v7
|
|
28
28
|
with:
|
|
29
29
|
name: gem-artifact
|
|
30
30
|
path: '*.gem'
|
|
@@ -39,7 +39,7 @@ jobs:
|
|
|
39
39
|
contents: write # clone repo and create release
|
|
40
40
|
steps:
|
|
41
41
|
- name: Download gem from GitHub cache
|
|
42
|
-
uses: actions/download-artifact@
|
|
42
|
+
uses: actions/download-artifact@v8
|
|
43
43
|
with:
|
|
44
44
|
name: gem-artifact
|
|
45
45
|
- name: Create Release
|
|
@@ -56,7 +56,7 @@ jobs:
|
|
|
56
56
|
packages: write # publish to rubygems.pkg.github.com
|
|
57
57
|
steps:
|
|
58
58
|
- name: Download gem from GitHub cache
|
|
59
|
-
uses: actions/download-artifact@
|
|
59
|
+
uses: actions/download-artifact@v8
|
|
60
60
|
with:
|
|
61
61
|
name: gem-artifact
|
|
62
62
|
- name: Publish gem to GitHub packages
|
|
@@ -73,10 +73,10 @@ jobs:
|
|
|
73
73
|
id-token: write # rubygems.org authentication
|
|
74
74
|
steps:
|
|
75
75
|
- name: Download gem from GitHub cache
|
|
76
|
-
uses: actions/download-artifact@
|
|
76
|
+
uses: actions/download-artifact@v8
|
|
77
77
|
with:
|
|
78
78
|
name: gem-artifact
|
|
79
|
-
- uses: rubygems/configure-rubygems-credentials@
|
|
79
|
+
- uses: rubygems/configure-rubygems-credentials@v2.1.0
|
|
80
80
|
- name: Publish gem to rubygems.org
|
|
81
81
|
shell: bash
|
|
82
82
|
run: gem push *.gem
|
|
@@ -92,7 +92,7 @@ jobs:
|
|
|
92
92
|
- release-to-rubygems
|
|
93
93
|
steps:
|
|
94
94
|
- name: Download gem from GitHub cache
|
|
95
|
-
uses: actions/download-artifact@
|
|
95
|
+
uses: actions/download-artifact@v8
|
|
96
96
|
with:
|
|
97
97
|
name: gem-artifact
|
|
98
98
|
- name: Install Ruby
|
data/.github/workflows/test.yml
CHANGED
|
@@ -10,11 +10,16 @@ on:
|
|
|
10
10
|
env:
|
|
11
11
|
BUNDLE_WITHOUT: release
|
|
12
12
|
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
13
16
|
jobs:
|
|
14
|
-
|
|
17
|
+
rubocop_and_matrix:
|
|
15
18
|
runs-on: ubuntu-latest
|
|
19
|
+
outputs:
|
|
20
|
+
ruby: ${{ steps.ruby.outputs.versions }}
|
|
16
21
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
22
|
+
- uses: actions/checkout@v7
|
|
18
23
|
- name: Setup ruby
|
|
19
24
|
uses: ruby/setup-ruby@v1
|
|
20
25
|
with:
|
|
@@ -22,21 +27,21 @@ jobs:
|
|
|
22
27
|
bundler-cache: true
|
|
23
28
|
- name: Run rake rubocop
|
|
24
29
|
run: bundle exec rake rubocop
|
|
30
|
+
- id: ruby
|
|
31
|
+
uses: voxpupuli/ruby-version@be0467ce7366d206b2e87f5b7a032a030120b7cb # 2.0.0
|
|
25
32
|
test:
|
|
26
33
|
runs-on: ubuntu-latest
|
|
34
|
+
needs: rubocop_and_matrix
|
|
27
35
|
strategy:
|
|
28
36
|
fail-fast: false
|
|
29
37
|
matrix:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
coverage: "yes"
|
|
33
|
-
- ruby: "3.3"
|
|
34
|
-
- ruby: "3.4"
|
|
35
|
-
env:
|
|
36
|
-
COVERAGE: ${{ matrix.coverage }}
|
|
38
|
+
ruby: ${{ fromJSON(needs.rubocop_and_matrix.outputs.ruby) }}
|
|
39
|
+
|
|
37
40
|
name: Ruby ${{ matrix.ruby }}
|
|
41
|
+
env:
|
|
42
|
+
COVERAGE: ${{ (matrix.ruby == '3.2' || matrix.ruby == '4.0') && 'yes' || 'no' }}
|
|
38
43
|
steps:
|
|
39
|
-
- uses: actions/checkout@
|
|
44
|
+
- uses: actions/checkout@v7
|
|
40
45
|
- name: Install Ruby ${{ matrix.ruby }}
|
|
41
46
|
uses: ruby/setup-ruby@v1
|
|
42
47
|
with:
|
|
@@ -47,10 +52,14 @@ jobs:
|
|
|
47
52
|
- name: Verify gem builds
|
|
48
53
|
run: gem build --strict --verbose *.gemspec
|
|
49
54
|
tests:
|
|
55
|
+
if: always()
|
|
50
56
|
needs:
|
|
51
|
-
-
|
|
57
|
+
- rubocop_and_matrix
|
|
52
58
|
- test
|
|
53
|
-
runs-on: ubuntu-
|
|
59
|
+
runs-on: ubuntu-26.04
|
|
54
60
|
name: Test suite
|
|
55
61
|
steps:
|
|
56
|
-
-
|
|
62
|
+
- name: Decide whether the needed jobs succeeded or failed
|
|
63
|
+
uses: re-actors/alls-green@release/v1
|
|
64
|
+
with:
|
|
65
|
+
jobs: ${{ toJSON(needs) }}
|
data/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [2.
|
|
5
|
+
## [2.2.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/2.2.0) (2026-10-08)
|
|
6
6
|
|
|
7
|
-
[Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/1.2.
|
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/v2.1.0...2.2.0)
|
|
8
|
+
|
|
9
|
+
**Implemented enhancements:**
|
|
10
|
+
|
|
11
|
+
- feat: make it work with openvox9 [\#129](https://github.com/voxpupuli/puppet-ghostbuster/pull/129) ([rwaffen](https://github.com/rwaffen))
|
|
12
|
+
|
|
13
|
+
**Merged pull requests:**
|
|
14
|
+
|
|
15
|
+
- Update voxpupuli-rubocop requirement from ~\> 5.2.0 to ~\> 5.3.0 [\#126](https://github.com/voxpupuli/puppet-ghostbuster/pull/126) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
16
|
+
- Update json requirement from \>= 2.0, \< 3.0 to \>= 2.0, \< 4.0 [\#124](https://github.com/voxpupuli/puppet-ghostbuster/pull/124) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
17
|
+
- Update github\_changelog\_generator requirement from ~\> 1.16.4 to ~\> 1.18 [\#120](https://github.com/voxpupuli/puppet-ghostbuster/pull/120) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
18
|
+
- Update voxpupuli-rubocop requirement from ~\> 5.1.0 to ~\> 5.2.0 [\#119](https://github.com/voxpupuli/puppet-ghostbuster/pull/119) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
19
|
+
|
|
20
|
+
## [v2.1.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/v2.1.0) (2026-02-27)
|
|
21
|
+
|
|
22
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/v2.0.0...v2.1.0)
|
|
23
|
+
|
|
24
|
+
**Merged pull requests:**
|
|
25
|
+
|
|
26
|
+
- Update syslog requirement from ~\> 0.3.0 to \>= 0.3, \< 0.5 [\#113](https://github.com/voxpupuli/puppet-ghostbuster/pull/113) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
27
|
+
- Update voxpupuli-rubocop requirement from ~\> 5.0.0 to ~\> 5.1.0 [\#110](https://github.com/voxpupuli/puppet-ghostbuster/pull/110) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
28
|
+
- README.md: Add note about execution directory [\#108](https://github.com/voxpupuli/puppet-ghostbuster/pull/108) ([bastelfreak](https://github.com/bastelfreak))
|
|
29
|
+
- Update rspec-its requirement from ~\> 1.0 to ~\> 2.0 [\#105](https://github.com/voxpupuli/puppet-ghostbuster/pull/105) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
30
|
+
|
|
31
|
+
## [v2.0.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/v2.0.0) (2025-10-16)
|
|
32
|
+
|
|
33
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/1.2.1...v2.0.0)
|
|
8
34
|
|
|
9
35
|
**Breaking changes:**
|
|
10
36
|
|
|
@@ -18,7 +44,6 @@ All notable changes to this project will be documented in this file.
|
|
|
18
44
|
|
|
19
45
|
**Merged pull requests:**
|
|
20
46
|
|
|
21
|
-
- Bump actions/checkout from 4 to 5 [\#100](https://github.com/voxpupuli/puppet-ghostbuster/pull/100) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
22
47
|
- Update voxpupuli-rubocop requirement from ~\> 2.6.0 to ~\> 2.8.0 [\#96](https://github.com/voxpupuli/puppet-ghostbuster/pull/96) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
23
48
|
- Update voxpupuli-rubocop requirement from ~\> 2.4.0 to ~\> 2.6.0 [\#93](https://github.com/voxpupuli/puppet-ghostbuster/pull/93) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
24
49
|
|
|
@@ -76,7 +101,6 @@ Due to problems during the migration from the camptocamp GitHub org to Vox Pupul
|
|
|
76
101
|
|
|
77
102
|
**Merged pull requests:**
|
|
78
103
|
|
|
79
|
-
- Bump actions/checkout from 3 to 4 [\#72](https://github.com/voxpupuli/puppet-ghostbuster/pull/72) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
80
104
|
- added some unsafe rubocop fixes [\#71](https://github.com/voxpupuli/puppet-ghostbuster/pull/71) ([zilchms](https://github.com/zilchms))
|
|
81
105
|
- Update puppet-lint requirement from \>= 1.0, \< 3.0 to \>= 1.0, \< 5.0 [\#70](https://github.com/voxpupuli/puppet-ghostbuster/pull/70) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
82
106
|
- modulesync 2023-8-23 [\#69](https://github.com/voxpupuli/puppet-ghostbuster/pull/69) ([zilchms](https://github.com/zilchms))
|
data/Gemfile
CHANGED
|
@@ -4,9 +4,11 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
|
|
4
4
|
|
|
5
5
|
gemspec
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
gem 'openvox', ENV['OPENVOX_VERSION'] if ENV['OPENVOX_VERSION']
|
|
8
|
+
|
|
9
|
+
group :release, optional: true do
|
|
8
10
|
gem 'faraday-retry', '~> 2.1', require: false
|
|
9
|
-
gem 'github_changelog_generator', '~> 1.
|
|
11
|
+
gem 'github_changelog_generator', '~> 1.18', require: false
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
group :coverage, optional: ENV['COVERAGE'] != 'yes' do
|
data/README.md
CHANGED
|
@@ -16,6 +16,8 @@ This gems helps puppet users to find dead code by displaying unused classes, def
|
|
|
16
16
|
|
|
17
17
|
This gems only support PuppetDB APi v4 (PuppetDB 3+)
|
|
18
18
|
|
|
19
|
+
Supports OpenVox 8 and 9 with Ruby 3.2 or newer.
|
|
20
|
+
|
|
19
21
|
Usage
|
|
20
22
|
-----
|
|
21
23
|
|
|
@@ -23,6 +25,8 @@ Usage
|
|
|
23
25
|
$ find . -type f -exec puppet-lint --only-checks ghostbuster_classes,ghostbuster_defines,ghostbuster_facts,ghostbuster_files,ghostbuster_functions,ghostbuster_hiera_files,ghostbuster_templates,ghostbuster_types {} \+
|
|
24
26
|
```
|
|
25
27
|
|
|
28
|
+
**the command has to be executed in your environment root, e.g. /etc/puppetlabs/code/environments/production/**
|
|
29
|
+
|
|
26
30
|
Environment variables
|
|
27
31
|
---------------------
|
|
28
32
|
|
|
@@ -32,7 +36,10 @@ The location of the `hiera.yaml` file. Defaults to `./hiera.yaml` or `/etc/puppe
|
|
|
32
36
|
|
|
33
37
|
### PUPPETDB_URL
|
|
34
38
|
|
|
35
|
-
The
|
|
39
|
+
The URL of PuppetDB.
|
|
40
|
+
If unset, uses the first server URL from `puppetdb.conf` when the PuppetDB integration is available,
|
|
41
|
+
otherwise `https://<server>:8081` using the `server` setting in `puppet.conf`.
|
|
42
|
+
OpenVox 9 has no default `server`, so configure it or set `PUPPETDB_URL` explicitly.
|
|
36
43
|
|
|
37
44
|
### PUPPETDB_CACERT_FILE
|
|
38
45
|
|
data/Rakefile
CHANGED
|
@@ -14,7 +14,7 @@ rescue LoadError
|
|
|
14
14
|
else
|
|
15
15
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
16
16
|
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
|
|
17
|
-
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog modulesync]
|
|
17
|
+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog modulesync github_actions]
|
|
18
18
|
config.user = 'voxpupuli'
|
|
19
19
|
config.project = 'puppet-ghostbuster'
|
|
20
20
|
config.future_release = Gem::Specification.load("#{config.project}.gemspec").version
|
|
@@ -5,17 +5,22 @@ class PuppetGhostbuster
|
|
|
5
5
|
class PuppetDB
|
|
6
6
|
Puppet.initialize_settings
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
def self.server_url
|
|
9
|
+
return ENV['PUPPETDB_URL'] if ENV['PUPPETDB_URL'] && !ENV['PUPPETDB_URL'].empty?
|
|
10
|
+
|
|
9
11
|
require 'puppet/util/puppetdb'
|
|
10
|
-
|
|
12
|
+
Puppet::Util::Puppetdb.config.server_urls[0]
|
|
11
13
|
rescue LoadError
|
|
12
|
-
|
|
14
|
+
server = Puppet[:server]
|
|
15
|
+
raise ArgumentError, 'Set PUPPETDB_URL or configure server in puppet.conf to connect to PuppetDB' if server.nil? || server.empty?
|
|
16
|
+
|
|
17
|
+
"https://#{server}:8081"
|
|
13
18
|
end
|
|
14
19
|
|
|
15
20
|
def self.client
|
|
16
21
|
@@client ||= begin
|
|
17
22
|
options = {
|
|
18
|
-
server:
|
|
23
|
+
server: server_url,
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
if ENV['PE_TOKEN']
|
data/puppet-ghostbuster.gemspec
CHANGED
|
@@ -24,11 +24,11 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
s.add_development_dependency 'rake', '>= 13.0.0', '< 14.0.0'
|
|
25
25
|
s.add_development_dependency 'rspec', '~> 3.0'
|
|
26
26
|
s.add_development_dependency 'rspec-collection_matchers', '~> 1.0'
|
|
27
|
-
s.add_development_dependency 'rspec-its', '~>
|
|
28
|
-
s.add_development_dependency 'voxpupuli-rubocop', '~> 5.
|
|
27
|
+
s.add_development_dependency 'rspec-its', '~> 2.0'
|
|
28
|
+
s.add_development_dependency 'voxpupuli-rubocop', '~> 5.3.0'
|
|
29
29
|
|
|
30
|
-
s.add_dependency 'json', '>= 2.0', '<
|
|
31
|
-
s.add_dependency 'openvox', '>= 8.0', '<
|
|
30
|
+
s.add_dependency 'json', '>= 2.0', '< 4.0'
|
|
31
|
+
s.add_dependency 'openvox', '>= 8.0', '< 10.0'
|
|
32
32
|
s.add_dependency 'puppetdb-ruby', '~> 1.1', '>= 1.1.1'
|
|
33
|
-
s.add_dependency 'syslog', '
|
|
33
|
+
s.add_dependency 'syslog', '>= 0.3', '< 0.5'
|
|
34
34
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe PuppetGhostbuster::PuppetDB do
|
|
6
|
+
describe '.server_url' do
|
|
7
|
+
around do |example|
|
|
8
|
+
original_url = ENV.fetch('PUPPETDB_URL', nil)
|
|
9
|
+
ENV.delete('PUPPETDB_URL')
|
|
10
|
+
example.run
|
|
11
|
+
ensure
|
|
12
|
+
if original_url
|
|
13
|
+
ENV['PUPPETDB_URL'] = original_url
|
|
14
|
+
else
|
|
15
|
+
ENV.delete('PUPPETDB_URL')
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'uses the explicit URL without loading the PuppetDB integration' do
|
|
20
|
+
ENV['PUPPETDB_URL'] = 'https://database.example.com:8081'
|
|
21
|
+
allow(described_class).to receive(:require)
|
|
22
|
+
expect(described_class.server_url).to eq('https://database.example.com:8081')
|
|
23
|
+
expect(described_class).not_to have_received(:require)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'uses the first URL from the PuppetDB integration' do
|
|
27
|
+
config = Struct.new(:server_urls).new(['https://database.example.com:8081'])
|
|
28
|
+
integration = Struct.new(:config).new(config)
|
|
29
|
+
stub_const('Puppet::Util::Puppetdb', integration)
|
|
30
|
+
allow(described_class).to receive(:require).with('puppet/util/puppetdb')
|
|
31
|
+
expect(described_class.server_url).to eq('https://database.example.com:8081')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
context 'without the PuppetDB integration' do
|
|
35
|
+
before do
|
|
36
|
+
allow(described_class).to receive(:require).with('puppet/util/puppetdb').and_raise(LoadError)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'uses the configured Puppet server' do
|
|
40
|
+
allow(Puppet).to receive(:[]).with(:server).and_return('compiler.example.com')
|
|
41
|
+
expect(described_class.server_url).to eq('https://compiler.example.com:8081')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'reports a missing server instead of constructing an invalid URL' do
|
|
45
|
+
allow(Puppet).to receive(:[]).with(:server).and_return('')
|
|
46
|
+
expect { described_class.server_url }.to raise_error(ArgumentError, /Set PUPPETDB_URL/)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'treats an empty explicit URL as unset' do
|
|
50
|
+
ENV['PUPPETDB_URL'] = ''
|
|
51
|
+
allow(Puppet).to receive(:[]).with(:server).and_return('compiler.example.com')
|
|
52
|
+
expect(described_class.server_url).to eq('https://compiler.example.com:8081')
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: puppet-ghostbuster
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Camptocamp
|
|
@@ -124,28 +124,28 @@ dependencies:
|
|
|
124
124
|
requirements:
|
|
125
125
|
- - "~>"
|
|
126
126
|
- !ruby/object:Gem::Version
|
|
127
|
-
version: '
|
|
127
|
+
version: '2.0'
|
|
128
128
|
type: :development
|
|
129
129
|
prerelease: false
|
|
130
130
|
version_requirements: !ruby/object:Gem::Requirement
|
|
131
131
|
requirements:
|
|
132
132
|
- - "~>"
|
|
133
133
|
- !ruby/object:Gem::Version
|
|
134
|
-
version: '
|
|
134
|
+
version: '2.0'
|
|
135
135
|
- !ruby/object:Gem::Dependency
|
|
136
136
|
name: voxpupuli-rubocop
|
|
137
137
|
requirement: !ruby/object:Gem::Requirement
|
|
138
138
|
requirements:
|
|
139
139
|
- - "~>"
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
|
-
version: 5.
|
|
141
|
+
version: 5.3.0
|
|
142
142
|
type: :development
|
|
143
143
|
prerelease: false
|
|
144
144
|
version_requirements: !ruby/object:Gem::Requirement
|
|
145
145
|
requirements:
|
|
146
146
|
- - "~>"
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
|
-
version: 5.
|
|
148
|
+
version: 5.3.0
|
|
149
149
|
- !ruby/object:Gem::Dependency
|
|
150
150
|
name: json
|
|
151
151
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -155,7 +155,7 @@ dependencies:
|
|
|
155
155
|
version: '2.0'
|
|
156
156
|
- - "<"
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
|
-
version: '
|
|
158
|
+
version: '4.0'
|
|
159
159
|
type: :runtime
|
|
160
160
|
prerelease: false
|
|
161
161
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -165,7 +165,7 @@ dependencies:
|
|
|
165
165
|
version: '2.0'
|
|
166
166
|
- - "<"
|
|
167
167
|
- !ruby/object:Gem::Version
|
|
168
|
-
version: '
|
|
168
|
+
version: '4.0'
|
|
169
169
|
- !ruby/object:Gem::Dependency
|
|
170
170
|
name: openvox
|
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -175,7 +175,7 @@ dependencies:
|
|
|
175
175
|
version: '8.0'
|
|
176
176
|
- - "<"
|
|
177
177
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '
|
|
178
|
+
version: '10.0'
|
|
179
179
|
type: :runtime
|
|
180
180
|
prerelease: false
|
|
181
181
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -185,7 +185,7 @@ dependencies:
|
|
|
185
185
|
version: '8.0'
|
|
186
186
|
- - "<"
|
|
187
187
|
- !ruby/object:Gem::Version
|
|
188
|
-
version: '
|
|
188
|
+
version: '10.0'
|
|
189
189
|
- !ruby/object:Gem::Dependency
|
|
190
190
|
name: puppetdb-ruby
|
|
191
191
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -210,22 +210,31 @@ dependencies:
|
|
|
210
210
|
name: syslog
|
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
|
212
212
|
requirements:
|
|
213
|
-
- - "
|
|
213
|
+
- - ">="
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: '0.3'
|
|
216
|
+
- - "<"
|
|
214
217
|
- !ruby/object:Gem::Version
|
|
215
|
-
version: 0.
|
|
218
|
+
version: '0.5'
|
|
216
219
|
type: :runtime
|
|
217
220
|
prerelease: false
|
|
218
221
|
version_requirements: !ruby/object:Gem::Requirement
|
|
219
222
|
requirements:
|
|
220
|
-
- - "
|
|
223
|
+
- - ">="
|
|
224
|
+
- !ruby/object:Gem::Version
|
|
225
|
+
version: '0.3'
|
|
226
|
+
- - "<"
|
|
221
227
|
- !ruby/object:Gem::Version
|
|
222
|
-
version: 0.
|
|
228
|
+
version: '0.5'
|
|
223
229
|
description: Try and find dead code in Puppet receipts
|
|
224
230
|
executables: []
|
|
225
231
|
extensions: []
|
|
226
232
|
extra_rdoc_files: []
|
|
227
233
|
files:
|
|
228
234
|
- ".github/dependabot.yml"
|
|
235
|
+
- ".github/labeler.yml"
|
|
236
|
+
- ".github/release.yml"
|
|
237
|
+
- ".github/workflows/labeler.yml"
|
|
229
238
|
- ".github/workflows/release.yml"
|
|
230
239
|
- ".github/workflows/test.yml"
|
|
231
240
|
- ".gitignore"
|
|
@@ -273,6 +282,7 @@ files:
|
|
|
273
282
|
- spec/puppet-lint/plugins/ghostbuster_hiera_files_spec.rb
|
|
274
283
|
- spec/puppet-lint/plugins/ghostbuster_templates_spec.rb
|
|
275
284
|
- spec/puppet-lint/plugins/ghostbuster_types_spec.rb
|
|
285
|
+
- spec/puppet_ghostbuster/puppet_db_spec.rb
|
|
276
286
|
- spec/spec_helper.rb
|
|
277
287
|
homepage: http://github.com/voxpupuli/puppet-ghostbuster
|
|
278
288
|
licenses:
|
|
@@ -292,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
292
302
|
- !ruby/object:Gem::Version
|
|
293
303
|
version: '0'
|
|
294
304
|
requirements: []
|
|
295
|
-
rubygems_version:
|
|
305
|
+
rubygems_version: 4.0.20
|
|
296
306
|
specification_version: 4
|
|
297
307
|
summary: Dead code detector for Puppet
|
|
298
308
|
test_files: []
|