ra10ke 1.2.0 → 2.0.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/test.yml +1 -4
- data/CHANGELOG.md +25 -0
- data/README.md +9 -0
- data/lib/ra10ke/dependencies.rb +167 -66
- data/lib/ra10ke/git_repo.rb +13 -1
- data/lib/ra10ke/puppetfile_parser.rb +2 -2
- data/lib/ra10ke/solve.rb +4 -0
- data/lib/ra10ke/version.rb +1 -1
- data/lib/ra10ke.rb +1 -0
- data/ra10ke.gemspec +2 -2
- data/spec/fixtures/Puppetfile_deprecation_issue +78 -0
- data/spec/fixtures/Puppetfile_git_conversion +28 -0
- data/spec/ra10ke/dependencies_spec.rb +49 -13
- data/spec/ra10ke/deprecation_spec.rb +11 -0
- data/spec/ra10ke/git_repo_spec.rb +4 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42a64a748cf4b63602804c2aac20987e23d8a7ad2a01ca3365d3ed998324f058
|
4
|
+
data.tar.gz: daa94b8601294ed8c480f431d396eda60c2a14d2c7aa608e4941189033c01b24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1b0a572ecb7928f0e38254f6ed91f4e501f2755497a53ced15a164ada79dfa2b335afe7f4565c27ae63050a17d57c8df45dd39dd5fbac0271361f00c8063c5a
|
7
|
+
data.tar.gz: 251245599d77dbbd4b01c3946693083782fe8b1f0937236fc207ca3c69616b967743cafa0bb8e4151407199fd8d4e0be0479da8e7f83009bb22f0fe9192785e1
|
data/.github/workflows/test.yml
CHANGED
@@ -2,7 +2,6 @@ name: Test
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
- pull_request
|
5
|
-
- push
|
6
5
|
|
7
6
|
env:
|
8
7
|
BUNDLE_WITHOUT: release
|
@@ -14,11 +13,9 @@ jobs:
|
|
14
13
|
fail-fast: false
|
15
14
|
matrix:
|
16
15
|
include:
|
17
|
-
- ruby: "2.4"
|
18
|
-
- ruby: "2.5"
|
19
|
-
- ruby: "2.6"
|
20
16
|
- ruby: "2.7"
|
21
17
|
- ruby: "3.0"
|
18
|
+
- ruby: "3.1"
|
22
19
|
coverage: "yes"
|
23
20
|
env:
|
24
21
|
COVERAGE: ${{ matrix.coverage }}
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,31 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [v2.0.0](https://github.com/voxpupuli/ra10ke/tree/v2.0.0) (2022-05-18)
|
6
|
+
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/ra10ke/compare/v1.2.0...v2.0.0)
|
8
|
+
|
9
|
+
**Breaking changes:**
|
10
|
+
|
11
|
+
- Bump minimal Ruby Version 2.4.0-\>2.7.0 [\#77](https://github.com/voxpupuli/ra10ke/pull/77) ([bastelfreak](https://github.com/bastelfreak))
|
12
|
+
- Dependencies Table output [\#72](https://github.com/voxpupuli/ra10ke/pull/72) ([logicminds](https://github.com/logicminds))
|
13
|
+
|
14
|
+
**Implemented enhancements:**
|
15
|
+
|
16
|
+
- Add Ruby 3.1 support [\#78](https://github.com/voxpupuli/ra10ke/pull/78) ([bastelfreak](https://github.com/bastelfreak))
|
17
|
+
- Converts puppet forge module entries into puppetfile git entries [\#76](https://github.com/voxpupuli/ra10ke/pull/76) ([logicminds](https://github.com/logicminds))
|
18
|
+
|
19
|
+
**Fixed bugs:**
|
20
|
+
|
21
|
+
- incompatible with r10k gem \> 3.8 [\#57](https://github.com/voxpupuli/ra10ke/issues/57)
|
22
|
+
- CI: Do not run twice [\#79](https://github.com/voxpupuli/ra10ke/pull/79) ([bastelfreak](https://github.com/bastelfreak))
|
23
|
+
- Fix \#74 - server responded with 400 [\#75](https://github.com/voxpupuli/ra10ke/pull/75) ([logicminds](https://github.com/logicminds))
|
24
|
+
- Fix \#70 - cache dir does not exist [\#71](https://github.com/voxpupuli/ra10ke/pull/71) ([logicminds](https://github.com/logicminds))
|
25
|
+
|
26
|
+
**Closed issues:**
|
27
|
+
|
28
|
+
- cache dir does not exist [\#70](https://github.com/voxpupuli/ra10ke/issues/70)
|
29
|
+
|
5
30
|
## [v1.2.0](https://github.com/voxpupuli/ra10ke/tree/v1.2.0) (2022-04-21)
|
6
31
|
|
7
32
|
[Full Changelog](https://github.com/voxpupuli/ra10ke/compare/v1.1.0...v1.2.0)
|
data/README.md
CHANGED
@@ -68,6 +68,15 @@ Ignoring specific modules:
|
|
68
68
|
Under specific conditions you may not wish to report on specific modules being out of date,
|
69
69
|
to ignore a module create `.r10kignore` file in the same directory as your Puppetfile.
|
70
70
|
|
71
|
+
### r10k::print_git_conversion
|
72
|
+
This rake task will go through the puppetfile and convert forge based modules into git based modules using
|
73
|
+
the modules't source repository and version tag.
|
74
|
+
|
75
|
+
This feature is useful when you want to bring all the forge modules into git source control. This assumes every module
|
76
|
+
tags the release or provides a valid repo url. We recommend to manually review
|
77
|
+
the output provided by this task before replacing the forge based content in your puppetfile as not every module author
|
78
|
+
tagged a release or provided a working url.
|
79
|
+
|
71
80
|
### r10k:solve_dependencies
|
72
81
|
|
73
82
|
Reads the Puppetfile in the current directory and uses the ruby 'solve' library to find
|
data/lib/ra10ke/dependencies.rb
CHANGED
@@ -1,37 +1,147 @@
|
|
1
|
+
require 'semverse'
|
2
|
+
require 'r10k/puppetfile'
|
3
|
+
require 'puppet_forge'
|
4
|
+
require 'table_print'
|
5
|
+
require 'git'
|
6
|
+
|
1
7
|
module Ra10ke::Dependencies
|
2
|
-
|
8
|
+
class Verification
|
3
9
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
+
def self.version_formats
|
11
|
+
@version_formats ||= {}
|
12
|
+
end
|
13
|
+
|
14
|
+
# Registers a block that finds the latest version.
|
15
|
+
# The block will be called with a list of tags.
|
16
|
+
# If the block returns nil the next format will be tried.
|
17
|
+
def self.register_version_format(name, &block)
|
18
|
+
version_formats[name] = block
|
19
|
+
end
|
20
|
+
|
21
|
+
Ra10ke::Dependencies::Verification.register_version_format(:semver) do |tags|
|
22
|
+
latest_tag = tags.map do |tag|
|
23
|
+
begin
|
24
|
+
Semverse::Version.new tag[/\Av?(.*)\Z/, 1]
|
25
|
+
rescue Semverse::InvalidVersionFormat
|
26
|
+
# ignore tags that do not comply to semver
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end.select { |tag| !tag.nil? }.sort.last.to_s.downcase
|
30
|
+
latest_ref = tags.detect { |tag| tag[/\Av?(.*)\Z/, 1] == latest_tag }
|
31
|
+
end
|
32
|
+
attr_reader :puppetfile
|
33
|
+
|
34
|
+
def initialize(pfile)
|
35
|
+
@puppetfile = pfile
|
36
|
+
# semver is the default version format.
|
37
|
+
|
38
|
+
puppetfile.load!
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_latest_ref(remote_refs)
|
42
|
+
tags = remote_refs['tags'].keys
|
43
|
+
latest_ref = nil
|
44
|
+
self.class.version_formats.detect { |_, block| latest_ref = block.call(tags) }
|
45
|
+
latest_ref = 'undef (tags do not follow any known pattern)' if latest_ref.nil?
|
46
|
+
latest_ref
|
47
|
+
end
|
48
|
+
|
49
|
+
def ignored_modules
|
50
|
+
# ignore file allows for "don't tell me about this"
|
51
|
+
@ignored_modules ||= begin
|
52
|
+
File.readlines('.r10kignore').each {|l| l.chomp!} if File.exist?('.r10kignore')
|
53
|
+
end || []
|
54
|
+
end
|
55
|
+
|
56
|
+
# @summary creates an array of module hashes with version info
|
57
|
+
# @param {Object} supplied_puppetfile - the parsed puppetfile object
|
58
|
+
# @returns {Array} array of version info for each module
|
59
|
+
# @note does not include ignored modules or modules up2date
|
60
|
+
def processed_modules(supplied_puppetfile = puppetfile)
|
61
|
+
threads = []
|
62
|
+
threads = supplied_puppetfile.modules.map do |puppet_module|
|
63
|
+
Thread.new do
|
64
|
+
begin
|
65
|
+
next if ignored_modules.include? puppet_module.title
|
66
|
+
if puppet_module.class == ::R10K::Module::Forge
|
67
|
+
module_name = puppet_module.title.gsub('/', '-')
|
68
|
+
forge_version = ::PuppetForge::Module.find(module_name).current_release.version
|
69
|
+
installed_version = puppet_module.expected_version
|
70
|
+
{
|
71
|
+
name: puppet_module.title,
|
72
|
+
installed: installed_version,
|
73
|
+
latest: forge_version,
|
74
|
+
type: 'forge',
|
75
|
+
message: installed_version != forge_version ? :outdated : :current
|
76
|
+
}
|
77
|
+
|
78
|
+
elsif puppet_module.class == R10K::Module::Git
|
79
|
+
# use helper; avoid `desired_ref`
|
80
|
+
# we do not want to deal with `:control_branch`
|
81
|
+
ref = puppet_module.version
|
82
|
+
next unless ref
|
83
|
+
|
84
|
+
remote = puppet_module.instance_variable_get(:@remote)
|
85
|
+
remote_refs = Git.ls_remote(remote)
|
86
|
+
|
87
|
+
# skip if ref is a branch
|
88
|
+
next if remote_refs['branches'].key?(ref)
|
89
|
+
|
90
|
+
if remote_refs['tags'].key?(ref)
|
91
|
+
# there are too many possible versioning conventions
|
92
|
+
# we have to be be opinionated here
|
93
|
+
# so semantic versioning (vX.Y.Z) it is for us
|
94
|
+
# as well as support for skipping the leading v letter
|
95
|
+
#
|
96
|
+
# register own version formats with
|
97
|
+
# Ra10ke::Dependencies.register_version_format(:name, &block)
|
98
|
+
latest_ref = get_latest_ref(remote_refs)
|
99
|
+
elsif ref.match(/^[a-z0-9]{40}$/)
|
100
|
+
ref = ref.slice(0,8)
|
101
|
+
# for sha just assume head should be tracked
|
102
|
+
latest_ref = remote_refs['head'][:sha].slice(0,8)
|
103
|
+
else
|
104
|
+
raise "Unable to determine ref type for #{puppet_module.title}"
|
105
|
+
end
|
106
|
+
{
|
107
|
+
name: puppet_module.title,
|
108
|
+
installed: ref,
|
109
|
+
latest: latest_ref,
|
110
|
+
type: 'git',
|
111
|
+
message: ref != latest_ref ? :outdated : :current
|
112
|
+
}
|
113
|
+
|
114
|
+
end
|
115
|
+
rescue R10K::Util::Subprocess::SubprocessError => e
|
116
|
+
{
|
117
|
+
name: puppet_module.title,
|
118
|
+
installed: nil,
|
119
|
+
latest: nil,
|
120
|
+
type: :error,
|
121
|
+
message: e.message
|
122
|
+
}
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
threads.map { |th| th.join.value }.compact
|
127
|
+
end
|
10
128
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
begin
|
15
|
-
Semverse::Version.new tag[/\Av?(.*)\Z/, 1]
|
16
|
-
rescue Semverse::InvalidVersionFormat
|
17
|
-
# ignore tags that do not comply to semver
|
18
|
-
nil
|
129
|
+
def outdated(supplied_puppetfile = puppetfile)
|
130
|
+
processed_modules.find_all do | mod |
|
131
|
+
mod[:message] == :outdated
|
19
132
|
end
|
20
|
-
end
|
21
|
-
latest_ref = tags.detect { |tag| tag[/\Av?(.*)\Z/, 1] == latest_tag }
|
22
|
-
end
|
133
|
+
end
|
23
134
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
latest_ref = 'undef (tags do not follow any known pattern)' if latest_ref.nil?
|
29
|
-
latest_ref
|
135
|
+
def print_table(mods)
|
136
|
+
puts
|
137
|
+
tp mods, { name: { width: 50 } }, :installed, :latest, :type, :message
|
138
|
+
end
|
30
139
|
end
|
31
140
|
|
32
|
-
def
|
33
|
-
desc "
|
34
|
-
task :
|
141
|
+
def define_task_print_git_conversion(*_args)
|
142
|
+
desc "Convert and print forge modules to git format"
|
143
|
+
task :print_git_conversion do
|
144
|
+
require 'ra10ke/git_repo'
|
35
145
|
require 'r10k/puppetfile'
|
36
146
|
require 'puppet_forge'
|
37
147
|
|
@@ -45,49 +155,40 @@ module Ra10ke::Dependencies
|
|
45
155
|
if File.exist?('.r10kignore')
|
46
156
|
ignore_modules = File.readlines('.r10kignore').each {|l| l.chomp!}
|
47
157
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
if puppet_module.class == R10K::Module::Git
|
61
|
-
# use helper; avoid `desired_ref`
|
62
|
-
# we do not want to deal with `:control_branch`
|
63
|
-
ref = puppet_module.version
|
64
|
-
next unless ref
|
65
|
-
|
66
|
-
remote = puppet_module.instance_variable_get(:@remote)
|
67
|
-
remote_refs = Git.ls_remote(remote)
|
68
|
-
|
69
|
-
# skip if ref is a branch
|
70
|
-
next if remote_refs['branches'].key?(ref)
|
71
|
-
|
72
|
-
if remote_refs['tags'].key?(ref)
|
73
|
-
# there are too many possible versioning conventions
|
74
|
-
# we have to be be opinionated here
|
75
|
-
# so semantic versioning (vX.Y.Z) it is for us
|
76
|
-
# as well as support for skipping the leading v letter
|
77
|
-
#
|
78
|
-
# register own version formats with
|
79
|
-
# Ra10ke::Dependencies.register_version_format(:name, &block)
|
80
|
-
latest_ref = get_latest_ref(remote_refs)
|
81
|
-
elsif ref.match(/^[a-z0-9]{40}$/)
|
82
|
-
# for sha just assume head should be tracked
|
83
|
-
latest_ref = remote_refs['head'][:sha]
|
84
|
-
else
|
85
|
-
raise "Unable to determine ref type for #{puppet_module.title}"
|
158
|
+
forge_mods = puppetfile.modules.find_all { |mod| mod.instance_of?(R10K::Module::Forge) && mod.v3_module.homepage_url? }
|
159
|
+
|
160
|
+
threads = forge_mods.map do |mod|
|
161
|
+
Thread.new do
|
162
|
+
source_url = mod.v3_module.attributes.dig(:current_release, :metadata, :source) || mod.v3_module.homepage_url
|
163
|
+
# git:// does not work with ls-remote command, convert to https
|
164
|
+
source_url = source_url.gsub('git://', 'https://')
|
165
|
+
source_url = source_url.gsub(/\Agit\@(.*)\:(.*)/) do
|
166
|
+
"https://#{$1}/#{$2}"
|
86
167
|
end
|
168
|
+
repo = ::Ra10ke::GitRepo.new(source_url)
|
169
|
+
ref = repo.get_ref_like(mod.expected_version)
|
170
|
+
ref_name = ref ? ref[:name] : "bad url or tag #{mod.expected_version} is missing"
|
171
|
+
<<~EOF
|
172
|
+
mod '#{mod.name}',
|
173
|
+
:git => '#{source_url}',
|
174
|
+
:ref => '#{ref_name}'
|
87
175
|
|
88
|
-
|
176
|
+
EOF
|
89
177
|
end
|
90
178
|
end
|
179
|
+
output = threads.map { |th| th.join.value }
|
180
|
+
puts output
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def define_task_dependencies(*_args)
|
185
|
+
desc "Print outdated forge modules"
|
186
|
+
task :dependencies do
|
187
|
+
PuppetForge.user_agent = "ra10ke/#{Ra10ke::VERSION}"
|
188
|
+
puppetfile = get_puppetfile
|
189
|
+
PuppetForge.host = puppetfile.forge if puppetfile.forge =~ /^http/
|
190
|
+
dependencies = Ra10ke::Dependencies::Verification.new(puppetfile)
|
191
|
+
dependencies.print_table(dependencies.outdated)
|
91
192
|
end
|
92
193
|
end
|
93
194
|
end
|
data/lib/ra10ke/git_repo.rb
CHANGED
@@ -85,8 +85,8 @@ module Ra10ke
|
|
85
85
|
@all_refs ||= begin
|
86
86
|
remote_refs.each_with_object([]) do |line, refs|
|
87
87
|
sha, ref = line.split("\t")
|
88
|
+
next refs if line.include?('redirecting')
|
88
89
|
next refs if sha.eql?('ref: refs/heads/master')
|
89
|
-
|
90
90
|
_, type, name, subtype = ref.chomp.split('/')
|
91
91
|
next refs unless name
|
92
92
|
|
@@ -99,6 +99,18 @@ module Ra10ke
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
+
# @summary searches all the refs for a ref similar to the name provided
|
103
|
+
# This is useful when looking for tags if a v or not a v
|
104
|
+
# @param ref_name [String]
|
105
|
+
# @return [String] the matching ref_name or nil
|
106
|
+
def get_ref_like(ref_name)
|
107
|
+
return nil unless valid_url?
|
108
|
+
ref = all_refs.find do |ref|
|
109
|
+
ref[:name].include?(ref_name)
|
110
|
+
end
|
111
|
+
ref
|
112
|
+
end
|
113
|
+
|
102
114
|
# useful for mocking easily
|
103
115
|
# @param cmd [String]
|
104
116
|
# @param silent [Boolean] set to true if you wish to send output to /dev/null, false by default
|
@@ -27,11 +27,11 @@ module Ra10ke
|
|
27
27
|
def modules(puppetfile)
|
28
28
|
@modules ||= begin
|
29
29
|
return [] unless File.exist?(puppetfile)
|
30
|
-
|
31
30
|
all_lines = File.read(puppetfile).lines.map(&:strip_comment)
|
32
31
|
# remove comments from all the lines
|
33
|
-
lines_without_comments = all_lines.reject { |line| line.match(/#.*\n/) }.join("\n")
|
32
|
+
lines_without_comments = all_lines.reject { |line| line.match(/#.*\n/) || line.empty? }.join("\n")
|
34
33
|
lines_without_comments.split(/^mod/).map do |line|
|
34
|
+
|
35
35
|
next nil if line =~ /^forge/
|
36
36
|
next nil if line.empty?
|
37
37
|
|
data/lib/ra10ke/solve.rb
CHANGED
@@ -6,6 +6,7 @@ require 'set'
|
|
6
6
|
require 'solve'
|
7
7
|
require 'yaml/store'
|
8
8
|
require 'semverse/version'
|
9
|
+
require 'fileutils'
|
9
10
|
|
10
11
|
# How many versions to fetch from the Forge, at most
|
11
12
|
FETCH_LIMIT = 3
|
@@ -35,6 +36,9 @@ module Ra10ke::Solve
|
|
35
36
|
end
|
36
37
|
# Actual new logic begins here:
|
37
38
|
cache = (ENV['XDG_CACHE_DIR'] || File.expand_path('~/.cache'))
|
39
|
+
|
40
|
+
FileUtils.mkdir_p(cache)
|
41
|
+
|
38
42
|
# Metadata cache, since the Forge is slow:
|
39
43
|
@metadata_cache = YAML::Store.new File.join(cache, 'ra10ke.metadata_cache')
|
40
44
|
# The graph of available module versions
|
data/lib/ra10ke/version.rb
CHANGED
data/lib/ra10ke.rb
CHANGED
data/ra10ke.gemspec
CHANGED
@@ -14,11 +14,11 @@ Gem::Specification.new do |spec|
|
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split($/)
|
16
16
|
spec.require_paths = ["lib"]
|
17
|
-
spec.required_ruby_version = '>= 2.
|
17
|
+
spec.required_ruby_version = '>= 2.6.0'
|
18
18
|
|
19
19
|
spec.add_dependency "rake"
|
20
20
|
spec.add_dependency "puppet_forge"
|
21
|
-
spec.add_dependency "r10k"
|
21
|
+
spec.add_dependency "r10k", '>= 2.6.5'
|
22
22
|
spec.add_dependency "git"
|
23
23
|
spec.add_dependency "solve"
|
24
24
|
spec.add_dependency 'semverse', '>= 2.0'
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# used in profiles
|
2
|
+
mod 'puppet/systemd', :latest
|
3
|
+
mod 'puppet/lldpd', :latest
|
4
|
+
mod 'puppet/ferm', :latest
|
5
|
+
mod 'puppet/borg', :latest
|
6
|
+
mod 'puppet/wireguard', :latest
|
7
|
+
mod 'puppet/bird', :latest
|
8
|
+
mod 'herculesteam/augeasproviders_pam', :latest
|
9
|
+
mod 'herculesteam/augeasproviders_shellvar', :latest
|
10
|
+
mod 'puppetlabs/vcsrepo', :latest
|
11
|
+
mod 'saz/ssh', :latest
|
12
|
+
mod 'puppet/r10k', :latest
|
13
|
+
mod 'puppet/dbbackup', :latest
|
14
|
+
mod 'puppet/mosquitto', :latest
|
15
|
+
mod 'puppet/grafana', :latest
|
16
|
+
mod 'puppet/nginx', :latest
|
17
|
+
mod 'puppet/ssh_keygen', :latest
|
18
|
+
mod 'puppet/unbound', :latest
|
19
|
+
mod 'puppetlabs/inifile', :latest
|
20
|
+
mod 'puppet/prometheus', :latest
|
21
|
+
mod 'theforeman/foreman', :latest
|
22
|
+
mod 'theforeman/puppet', :latest
|
23
|
+
mod 'theforeman/foreman_proxy', :latest
|
24
|
+
mod 'puppet/nftables', :latest
|
25
|
+
mod 'herculesteam/augeasproviders_sysctl', :latest
|
26
|
+
mod 'camptocamp/catalog_diff', :latest
|
27
|
+
mod 'puppet/unattended_upgrades', :latest
|
28
|
+
mod 'puppet/selinux', :latest
|
29
|
+
mod 'choria/choria', :latest
|
30
|
+
mod 'puppet/archive', :latest
|
31
|
+
mod 'puppet/elasticsearch', :latest
|
32
|
+
mod 'jsok/vault',
|
33
|
+
git: 'https://github.com/bastelfreak/puppet-vault',
|
34
|
+
ref: 'test'
|
35
|
+
|
36
|
+
# dependencies
|
37
|
+
mod 'herculesteam/augeasproviders_core', :latest
|
38
|
+
mod 'puppetlabs/stdlib', :latest
|
39
|
+
mod 'choria/mcollective', :latest
|
40
|
+
mod 'puppetlabs/concat', :latest
|
41
|
+
mod 'puppetlabs/apt', :latest
|
42
|
+
mod 'puppetlabs/apache', :latest
|
43
|
+
mod 'puppetlabs/postgresql', :latest
|
44
|
+
mod 'puppet/extlib', :latest
|
45
|
+
mod 'puppet/redis', :latest
|
46
|
+
mod 'puppet/epel', :latest
|
47
|
+
mod 'theforeman/puppetserver_foreman', :latest
|
48
|
+
mod 'richardc/datacat', :latest
|
49
|
+
mod 'theforeman/dns', :latest
|
50
|
+
mod 'theforeman/dhcp', :latest
|
51
|
+
mod 'theforeman/tftp', :latest
|
52
|
+
mod 'puppetlabs/xinetd', :latest
|
53
|
+
mod 'choria-mcollective_choria', :latest
|
54
|
+
mod 'choria/mcollective_agent_puppet', :latest
|
55
|
+
mod 'choria/mcollective_agent_package', :latest
|
56
|
+
mod 'choria/mcollective_agent_service', :latest
|
57
|
+
mod 'choria/mcollective_agent_filemgr', :latest
|
58
|
+
mod 'choria/mcollective_agent_shell', :latest
|
59
|
+
mod 'choria/mcollective_agent_nettest', :latest
|
60
|
+
mod 'choria/mcollective_agent_puppetca', :latest
|
61
|
+
mod 'choria/mcollective_agent_bolt_tasks', :latest
|
62
|
+
mod 'choria/mcollective_agent_iptables', :latest
|
63
|
+
mod 'choria/mcollective_agent_process', :latest
|
64
|
+
mod 'choria/mcollective_util_actionpolicy', :latest
|
65
|
+
mod 'optiz0r/mcollective_agent_puppet_env', :latest
|
66
|
+
mod 'jay7x/mcollective_agent_query', :latest
|
67
|
+
mod 'choria/mcollective_data_sysctl', :latest
|
68
|
+
mod 'puppet/yum', :latest
|
69
|
+
mod 'puppetlabs/java', :latest
|
70
|
+
mod 'puppet/elastic_stack', :latest
|
71
|
+
mod 'puppet/hashi_stack', :latest
|
72
|
+
|
73
|
+
# core modules are not vendored on Gentoo
|
74
|
+
mod 'puppetlabs-sshkeys_core', :latest
|
75
|
+
mod 'puppetlabs-mount_core', :latest
|
76
|
+
mod 'puppetlabs-augeas_core', :latest
|
77
|
+
mod 'puppetlabs-selinux_core', :latest
|
78
|
+
mod 'puppetlabs-yumrepo_core', :latest
|
@@ -0,0 +1,28 @@
|
|
1
|
+
mod 'choria',
|
2
|
+
:git => 'https://github.com/choria-io/puppet-choria',
|
3
|
+
:ref => '0.26.2'
|
4
|
+
|
5
|
+
mod 'inifile',
|
6
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-inifile',
|
7
|
+
:ref => '2.2.0'
|
8
|
+
|
9
|
+
mod 'ruby',
|
10
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-ruby.git',
|
11
|
+
:ref => 'v1.0.1'
|
12
|
+
|
13
|
+
mod 'stdlib',
|
14
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib',
|
15
|
+
:ref => '4.24.0'
|
16
|
+
|
17
|
+
mod 'concat',
|
18
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-concat',
|
19
|
+
:ref => '4.0.0'
|
20
|
+
|
21
|
+
mod 'ntp',
|
22
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-ntp',
|
23
|
+
:ref => '6.4.1'
|
24
|
+
|
25
|
+
mod 'archive',
|
26
|
+
:git => 'https://github.com/voxpupuli/puppet-archive',
|
27
|
+
:ref => 'v3.1.1'
|
28
|
+
|
@@ -1,35 +1,59 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
require 'r10k/puppetfile'
|
3
3
|
require 'spec_helper'
|
4
4
|
require 'ra10ke/dependencies'
|
5
|
+
require 'ra10ke'
|
6
|
+
|
5
7
|
RSpec::Mocks.configuration.allow_message_expectations_on_nil = true
|
6
8
|
|
7
9
|
RSpec.describe 'Ra10ke::Dependencies::Verification' do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
let(:instance) do
|
11
|
+
pfile = R10K::Puppetfile.new(File.basename(puppetfile), nil,puppetfile, nil, false)
|
12
|
+
Ra10ke::Dependencies::Verification.new(pfile)
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:puppetfile) do
|
16
|
+
File.join(fixtures_dir, 'Puppetfile')
|
12
17
|
end
|
13
18
|
|
14
19
|
context 'register_version_format' do
|
15
20
|
it 'default contains semver' do
|
16
|
-
expect(Ra10ke::Dependencies.
|
21
|
+
expect(Ra10ke::Dependencies::Verification.version_formats).to have_key(:semver)
|
17
22
|
end
|
18
23
|
it 'add new version format' do
|
19
|
-
Ra10ke::Dependencies.register_version_format(:test) do |tags|
|
24
|
+
Ra10ke::Dependencies::Verification.register_version_format(:test) do |tags|
|
20
25
|
nil
|
21
26
|
end
|
22
|
-
expect(Ra10ke::Dependencies.
|
27
|
+
expect(Ra10ke::Dependencies::Verification.version_formats).to have_key(:test)
|
23
28
|
end
|
24
29
|
end
|
25
30
|
|
26
|
-
context '
|
31
|
+
context 'show output in table format' do
|
27
32
|
let(:instance) do
|
28
|
-
|
29
|
-
|
30
|
-
|
33
|
+
pfile = R10K::Puppetfile.new(File.basename(puppetfile), nil,puppetfile, nil, false)
|
34
|
+
Ra10ke::Dependencies::Verification.new(pfile)
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:puppetfile) do
|
38
|
+
File.join(fixtures_dir, 'Puppetfile')
|
39
|
+
end
|
40
|
+
|
41
|
+
let(:processed_modules) do
|
42
|
+
instance.outdated
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'have dependencies array' do
|
46
|
+
expect(processed_modules).to be_a Array
|
31
47
|
end
|
32
48
|
|
49
|
+
it 'show dependencies as table' do
|
50
|
+
instance.print_table(processed_modules)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'get_latest_ref' do
|
56
|
+
|
33
57
|
context 'find latest semver tag' do
|
34
58
|
let(:latest_tag) do
|
35
59
|
'v1.1.0'
|
@@ -60,7 +84,7 @@ RSpec.describe 'Ra10ke::Dependencies::Verification' do
|
|
60
84
|
end
|
61
85
|
|
62
86
|
it do
|
63
|
-
Ra10ke::Dependencies.register_version_format(:number) do |tags|
|
87
|
+
Ra10ke::Dependencies::Verification.register_version_format(:number) do |tags|
|
64
88
|
tags.detect { |tag| tag == latest_tag }
|
65
89
|
end
|
66
90
|
expect(instance.get_latest_ref({
|
@@ -68,5 +92,17 @@ RSpec.describe 'Ra10ke::Dependencies::Verification' do
|
|
68
92
|
})).to eq(latest_tag)
|
69
93
|
end
|
70
94
|
end
|
95
|
+
|
96
|
+
context 'convert to ref' do
|
97
|
+
|
98
|
+
it 'run rake task' do
|
99
|
+
output_conversion = File.read(File.join(fixtures_dir, 'Puppetfile_git_conversion'))
|
100
|
+
require 'ra10ke'
|
101
|
+
Ra10ke::RakeTask.new do |t|
|
102
|
+
t.basedir = fixtures_dir
|
103
|
+
end
|
104
|
+
expect{Rake::Task['r10k:print_git_conversion'].invoke}.to output(output_conversion).to_stdout
|
105
|
+
end
|
106
|
+
end
|
71
107
|
end
|
72
108
|
end
|
@@ -34,4 +34,15 @@ RSpec.describe 'Ra10ke::Deprecation::Validation' do
|
|
34
34
|
|
35
35
|
expect(instance.bad_mods?).to eq(false)
|
36
36
|
end
|
37
|
+
|
38
|
+
describe 'handles large puppetfile' do
|
39
|
+
let(:puppetfile) do
|
40
|
+
File.join(fixtures_dir, 'Puppetfile_deprecation_issue')
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'deprecated modules' do
|
44
|
+
expect(instance.bad_mods?).to eq(false)
|
45
|
+
expect(instance.deprecated_modules.count).to eq(0)
|
46
|
+
end
|
47
|
+
end
|
37
48
|
end
|
@@ -38,6 +38,10 @@ RSpec.describe 'Ra10ke::GitRepo' do
|
|
38
38
|
expect(instance.remote_refs.first).to eq("1b3322d525e96bf7d0565b08703e2a44c90e7b4a\tHEAD\n")
|
39
39
|
end
|
40
40
|
|
41
|
+
it '#get_ref_like' do
|
42
|
+
expect(instance.get_ref_like('8.0.0'))
|
43
|
+
end
|
44
|
+
|
41
45
|
it '#valid_ref?' do
|
42
46
|
expect(instance.valid_ref?('master')).to be true
|
43
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ra10ke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Chatzimichos
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 2.6.5
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 2.6.5
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: git
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,6 +184,8 @@ files:
|
|
184
184
|
- lib/ra10ke/version.rb
|
185
185
|
- ra10ke.gemspec
|
186
186
|
- spec/fixtures/Puppetfile
|
187
|
+
- spec/fixtures/Puppetfile_deprecation_issue
|
188
|
+
- spec/fixtures/Puppetfile_git_conversion
|
187
189
|
- spec/fixtures/Puppetfile_test
|
188
190
|
- spec/fixtures/Puppetfile_with_bad_refs
|
189
191
|
- spec/fixtures/Puppetfile_with_commit
|
@@ -213,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
215
|
requirements:
|
214
216
|
- - ">="
|
215
217
|
- !ruby/object:Gem::Version
|
216
|
-
version: 2.
|
218
|
+
version: 2.6.0
|
217
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
220
|
requirements:
|
219
221
|
- - ">="
|