r10k 3.14.0 → 3.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec_tests.yml +3 -3
- data/.github/workflows/stale.yml +2 -0
- data/.gitignore +1 -0
- data/CHANGELOG.mkd +8 -0
- data/doc/dynamic-environments/configuration.mkd +31 -6
- data/doc/git/providers.mkd +22 -0
- data/docker/Makefile +1 -1
- data/docker/r10k/Dockerfile +1 -1
- data/docker/r10k/release.Dockerfile +1 -1
- data/lib/r10k/environment/with_modules.rb +1 -1
- data/lib/r10k/git/rugged/bare_repository.rb +1 -1
- data/lib/r10k/git/rugged/credentials.rb +1 -1
- data/lib/r10k/git/rugged/working_repository.rb +1 -1
- data/lib/r10k/module/base.rb +6 -2
- data/lib/r10k/module/forge.rb +10 -10
- data/lib/r10k/module/git.rb +1 -3
- data/lib/r10k/module/local.rb +1 -1
- data/lib/r10k/module_loader/puppetfile/dsl.rb +1 -1
- data/lib/r10k/module_loader/puppetfile.rb +3 -1
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +23 -15
- data/r10k.gemspec +1 -1
- data/spec/unit/module/forge_spec.rb +9 -7
- data/spec/unit/module_loader/puppetfile_spec.rb +15 -2
- data/spec/unit/module_spec.rb +14 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51cffcbc4e3340cf55e51da3a60e66e4c4b851d17bdd566d257213e6a4244bdc
|
4
|
+
data.tar.gz: 10c04f87924b3c5f4eb84cba797879a0a1ac09a6fbc3e0f598c53788d1d5f9b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8684fc987a031207807de406810ec0529ef00ab8cad321923451a51d5d869ec2aee3cbca411ca37dbe1bbc7ec3c4a0e7daa58df099b0bc1c74005e5c914e0ba2
|
7
|
+
data.tar.gz: b8515912cdc5099dfd5c238da01663f7352185bd8454363cdce4bf562138302002fd563fe7783c212071fee2a8855f5abc78dd7d66c1dc006595613b697cd8eb
|
@@ -16,9 +16,9 @@ jobs:
|
|
16
16
|
- {os: ubuntu-18.04, ruby: 2.6}
|
17
17
|
- {os: ubuntu-18.04, ruby: 2.7}
|
18
18
|
- {os: ubuntu-18.04, ruby: jruby-9.2.10.0}
|
19
|
-
- {os: windows-
|
20
|
-
- {os: windows-
|
21
|
-
- {os: windows-
|
19
|
+
- {os: windows-2019, ruby: 2.5}
|
20
|
+
- {os: windows-2019, ruby: 2.6}
|
21
|
+
- {os: windows-2019, ruby: 2.7}
|
22
22
|
|
23
23
|
runs-on: ${{ matrix.cfg.os }}
|
24
24
|
steps:
|
data/.github/workflows/stale.yml
CHANGED
@@ -15,5 +15,7 @@ jobs:
|
|
15
15
|
days-before-close: 7
|
16
16
|
stale-issue-message: 'This issue has been marked stale because it has had no activity for 60 days. The Puppet Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.'
|
17
17
|
stale-issue-label: 'stale'
|
18
|
+
exempt-issue-labels: 'community interest'
|
18
19
|
stale-pr-message: "This PR has been marked stale because it has had no activity for 60 days. If you are still interested in getting this merged, please comment and we'll try to move it forward. Otherwise, it will be closed in 7 days."
|
19
20
|
stale-pr-label: 'stale'
|
21
|
+
exempt-pr-labels: 'community interest'
|
data/.gitignore
CHANGED
data/CHANGELOG.mkd
CHANGED
@@ -4,6 +4,14 @@ CHANGELOG
|
|
4
4
|
Unreleased
|
5
5
|
----------
|
6
6
|
|
7
|
+
3.14.1
|
8
|
+
------
|
9
|
+
|
10
|
+
- (RK-395) Make `exclude_spec` from a Puppetfile the priority override [#1271](https://github.com/puppetlabs/r10k/issues/1271)
|
11
|
+
- (RK-394) Fix `force` always resolving to true for `puppetfile install` [#1269](https://github.com/puppetlabs/r10k/issues/1265)
|
12
|
+
- (RK-393) Bug fix: not all spec directories are deleted when :exclude_spec is true [#1267](https://github.com/puppetlabs/r10k/pull/1267)
|
13
|
+
- Refactor internal module creation to always expect a hash, even for Forge modules, which can be specified in the Puppetfile with just a version string. [#1170](https://github.com/puppetlabs/r10k/pull/1170)
|
14
|
+
|
7
15
|
3.14.0
|
8
16
|
------
|
9
17
|
|
@@ -128,6 +128,18 @@ git:
|
|
128
128
|
private_key: "/etc/puppetlabs/r10k/ssh/id_rsa"
|
129
129
|
```
|
130
130
|
|
131
|
+
#### oauth_token
|
132
|
+
|
133
|
+
The oauth_token setting is only used by the Rugged git provider.
|
134
|
+
|
135
|
+
The oauth_token option specifies the path to the default access token for Git HTTPS remotes.
|
136
|
+
Public git repositories can be accessed via HTTPS without authentication, but the oauth_token setting may be set if any non-public HTTPS remotes are used.
|
137
|
+
|
138
|
+
```yaml
|
139
|
+
git:
|
140
|
+
oauth_token: "/etc/puppetlabs/r10k/token"
|
141
|
+
```
|
142
|
+
|
131
143
|
#### repositories
|
132
144
|
|
133
145
|
The repositories option allows configuration to be set on a per-remote basis. Each entry is a map of
|
@@ -145,6 +157,18 @@ git:
|
|
145
157
|
private_key: "/etc/puppetlabs/r10k/ssh/id_rsa-protected-repo-deploy-key"
|
146
158
|
```
|
147
159
|
|
160
|
+
##### oauth_token
|
161
|
+
|
162
|
+
A repository specific access token to use for HTTPS connections for the given repository URL. This
|
163
|
+
overrides the global oauth_token setting.
|
164
|
+
|
165
|
+
```yaml
|
166
|
+
git:
|
167
|
+
repositories:
|
168
|
+
- remote: "https://tessier-ashpool.freeside/protected-repo.git"
|
169
|
+
oauth_token: "/etc/puppetlabs/r10k/protected-repo-deploy-token"
|
170
|
+
```
|
171
|
+
|
148
172
|
##### proxy
|
149
173
|
|
150
174
|
The 'proxy' setting allows you to set or override the global proxy setting for a single, specific
|
@@ -349,12 +373,13 @@ deploy:
|
|
349
373
|
|
350
374
|
#### exclude_spec
|
351
375
|
|
352
|
-
During module deployment, r10k's default behavior is to deploy the spec directory.
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
376
|
+
During module deployment, r10k's default behavior is to deploy the spec directory. Setting
|
377
|
+
`exclude_spec` to true will deploy modules without their spec directory. This behavior
|
378
|
+
can be configured for all modules using the `exclude_spec` setting in the r10k config.
|
379
|
+
It can also be passed as a CLI argument for `deploy environment/module`, overriding the
|
380
|
+
r10k config. Setting this per module in a `Puppetfile` will override the default, r10k config,
|
381
|
+
and cli flag for that module. The following example sets all modules to not deploy the spec
|
382
|
+
dir via the r10k config.
|
358
383
|
|
359
384
|
```yaml
|
360
385
|
deploy:
|
data/doc/git/providers.mkd
CHANGED
@@ -56,6 +56,28 @@ git:
|
|
56
56
|
private_key: '/root/.ssh/private_repo_id'
|
57
57
|
```
|
58
58
|
|
59
|
+
### HTTPS Configuration
|
60
|
+
|
61
|
+
Public HTTPS based Git repositories can be accessed with no additional settings.
|
62
|
+
For repos that do require authentication, the 'oauth_token' option may be provided.
|
63
|
+
|
64
|
+
```yaml
|
65
|
+
git:
|
66
|
+
oauth_token: '/etc/puppetlabs/r10k/token'
|
67
|
+
```
|
68
|
+
|
69
|
+
If you have per repository access tokens you can add them with the repositories list.
|
70
|
+
|
71
|
+
```yaml
|
72
|
+
git:
|
73
|
+
# default access token
|
74
|
+
oauth_token: '/etc/puppetlabs/r10k/token'
|
75
|
+
repositories:
|
76
|
+
- remote: "https://github.com/my_org/private_repo.git"
|
77
|
+
# access token for this repo only
|
78
|
+
oauth_token: '/etc/puppetlabs/r10k/private_repo_token'
|
79
|
+
```
|
80
|
+
|
59
81
|
#### Supported transports with Rugged
|
60
82
|
|
61
83
|
Rugged compiles libgit2 and and the Ruby bindings when the gem is installed. You
|
data/docker/Makefile
CHANGED
@@ -6,7 +6,7 @@ build_date := $(shell date -u +%FT%T)
|
|
6
6
|
hadolint_available := $(shell hadolint --help > /dev/null 2>&1; echo $$?)
|
7
7
|
hadolint_command := hadolint
|
8
8
|
hadolint_container := ghcr.io/hadolint/hadolint:latest
|
9
|
-
alpine_version := 3.
|
9
|
+
alpine_version := 3.14
|
10
10
|
export BUNDLE_PATH = $(PWD)/.bundle/gems
|
11
11
|
export BUNDLE_BIN = $(PWD)/.bundle/bin
|
12
12
|
export GEMFILE = $(PWD)/Gemfile
|
data/docker/r10k/Dockerfile
CHANGED
@@ -96,7 +96,7 @@ class R10K::Environment::WithModules < R10K::Environment::Base
|
|
96
96
|
def load_modules(module_hash)
|
97
97
|
module_hash.each do |name, args|
|
98
98
|
if !args.is_a?(Hash)
|
99
|
-
args = { version: args }
|
99
|
+
args = { type: 'forge', version: args }
|
100
100
|
end
|
101
101
|
|
102
102
|
add_module(name, args)
|
@@ -64,7 +64,7 @@ class R10K::Git::Rugged::BareRepository < R10K::Git::Rugged::BaseRepository
|
|
64
64
|
results = nil
|
65
65
|
|
66
66
|
R10K::Git.with_proxy(proxy) do
|
67
|
-
results = with_repo { |repo| repo.fetch(remote_name, refspecs, options) }
|
67
|
+
results = with_repo { |repo| repo.fetch(remote_name, refspecs, **options) }
|
68
68
|
end
|
69
69
|
|
70
70
|
report_transfer(results, remote_name)
|
@@ -130,7 +130,7 @@ class R10K::Git::Rugged::Credentials
|
|
130
130
|
|
131
131
|
user = nil
|
132
132
|
|
133
|
-
if !username_from_url.nil?
|
133
|
+
if !username_from_url.nil? && !username_from_url.empty?
|
134
134
|
user = username_from_url
|
135
135
|
logger.debug2 _("URL %{url} includes the username %{username}, using that user for authentication.") % {url: url.inspect, username: username_from_url}
|
136
136
|
elsif git_user
|
@@ -93,7 +93,7 @@ class R10K::Git::Rugged::WorkingRepository < R10K::Git::Rugged::BaseRepository
|
|
93
93
|
results = nil
|
94
94
|
|
95
95
|
R10K::Git.with_proxy(proxy) do
|
96
|
-
results = with_repo { |repo| repo.fetch(remote_name, refspecs, options) }
|
96
|
+
results = with_repo { |repo| repo.fetch(remote_name, refspecs, **options) }
|
97
97
|
end
|
98
98
|
|
99
99
|
report_transfer(results, remote)
|
data/lib/r10k/module/base.rb
CHANGED
@@ -60,8 +60,12 @@ class R10K::Module::Base
|
|
60
60
|
@environment = environment
|
61
61
|
@overrides = args.delete(:overrides) || {}
|
62
62
|
@spec_deletable = true
|
63
|
-
@exclude_spec =
|
64
|
-
@exclude_spec = @overrides
|
63
|
+
@exclude_spec = false
|
64
|
+
@exclude_spec = @overrides.dig(:modules, :exclude_spec) if @overrides.dig(:modules, :exclude_spec)
|
65
|
+
if args.has_key?(:exclude_spec)
|
66
|
+
logger.debug2 _("Overriding :exclude_spec setting with per module setting for #{@title}")
|
67
|
+
@exclude_spec = args.delete(:exclude_spec)
|
68
|
+
end
|
65
69
|
@origin = 'external' # Expect Puppetfile or R10k::Environment to set this to a specific value
|
66
70
|
|
67
71
|
@requested_modules = @overrides.dig(:modules, :requested_modules) || []
|
data/lib/r10k/module/forge.rb
CHANGED
@@ -13,16 +13,7 @@ class R10K::Module::Forge < R10K::Module::Base
|
|
13
13
|
R10K::Module.register(self)
|
14
14
|
|
15
15
|
def self.implement?(name, args)
|
16
|
-
args[:type].to_s == 'forge'
|
17
|
-
(!!
|
18
|
-
((args.keys & %i{git svn type}).empty? &&
|
19
|
-
args.has_key?(:version) &&
|
20
|
-
name.match(%r[\w+[/-]\w+]) &&
|
21
|
-
valid_version?(args[:version])))
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.valid_version?(expected_version)
|
25
|
-
expected_version == :latest || expected_version.nil? || PuppetForge::Util.version_valid?(expected_version)
|
16
|
+
args[:type].to_s == 'forge'
|
26
17
|
end
|
27
18
|
|
28
19
|
def self.statically_defined_version(name, args)
|
@@ -54,11 +45,20 @@ class R10K::Module::Forge < R10K::Module::Base
|
|
54
45
|
:type => ::R10K::Util::Setopts::Ignore,
|
55
46
|
}, :raise_on_unhandled => false)
|
56
47
|
|
48
|
+
# Validate version and raise on issue. Title is validated by base class.
|
49
|
+
unless valid_version?(@expected_version)
|
50
|
+
raise ArgumentError, _("Module version %{ver} is not a valid Forge module version") % {ver: @expected_version}
|
51
|
+
end
|
52
|
+
|
57
53
|
@expected_version ||= current_version || :latest
|
58
54
|
|
59
55
|
@v3_module = PuppetForge::V3::Module.new(:slug => @title)
|
60
56
|
end
|
61
57
|
|
58
|
+
def valid_version?(version)
|
59
|
+
version == :latest || version.nil? || PuppetForge::Util.version_valid?(version)
|
60
|
+
end
|
61
|
+
|
62
62
|
# @param [Hash] opts Deprecated
|
63
63
|
# @return [Boolean] true if the module was updated, false otherwise
|
64
64
|
def sync(opts={})
|
data/lib/r10k/module/git.rb
CHANGED
@@ -9,8 +9,6 @@ class R10K::Module::Git < R10K::Module::Base
|
|
9
9
|
|
10
10
|
def self.implement?(name, args)
|
11
11
|
args.has_key?(:git) || args[:type].to_s == 'git'
|
12
|
-
rescue
|
13
|
-
false
|
14
12
|
end
|
15
13
|
|
16
14
|
# Will be called if self.implement? above returns true. Will return
|
@@ -69,7 +67,7 @@ class R10K::Module::Git < R10K::Module::Base
|
|
69
67
|
:default_branch_override => :default_override_ref,
|
70
68
|
}, :raise_on_unhandled => false)
|
71
69
|
|
72
|
-
force = @overrides
|
70
|
+
force = @overrides[:force]
|
73
71
|
@force = force == false ? false : true
|
74
72
|
|
75
73
|
@desired_ref ||= 'master'
|
data/lib/r10k/module/local.rb
CHANGED
@@ -8,7 +8,7 @@ class R10K::Module::Local < R10K::Module::Base
|
|
8
8
|
R10K::Module.register(self)
|
9
9
|
|
10
10
|
def self.implement?(name, args)
|
11
|
-
args
|
11
|
+
args[:local] || args[:type].to_s == 'local'
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.statically_defined_version(*)
|
@@ -196,8 +196,10 @@ module R10K
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def parse_module_definition(name, info)
|
199
|
+
# The only valid (deprecated) way a module can be defined with a
|
200
|
+
# non-hash info is if it is a Forge module.
|
199
201
|
if !info.is_a?(Hash)
|
200
|
-
info = { version: info }
|
202
|
+
info = { type: 'forge', version: info }
|
201
203
|
end
|
202
204
|
|
203
205
|
info[:overrides] = @overrides
|
data/lib/r10k/version.rb
CHANGED
@@ -2,5 +2,5 @@ module R10K
|
|
2
2
|
# When updating to a new major (X) or minor (Y) version, include `#major` or
|
3
3
|
# `#minor` (respectively) in your commit message to trigger the appropriate
|
4
4
|
# release. Otherwise, a new patch (Z) version will be released.
|
5
|
-
VERSION = '3.14.
|
5
|
+
VERSION = '3.14.1'
|
6
6
|
end
|
data/locales/r10k.pot
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# SOME DESCRIPTIVE TITLE.
|
2
|
-
# Copyright (C)
|
2
|
+
# Copyright (C) 2022 Puppet, Inc.
|
3
3
|
# This file is distributed under the same license as the r10k package.
|
4
|
-
# FIRST AUTHOR <EMAIL@ADDRESS>,
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
|
5
5
|
#
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: r10k 3.9.3-
|
9
|
+
"Project-Id-Version: r10k 3.9.3-208-gb88bb368\n"
|
10
10
|
"\n"
|
11
11
|
"Report-Msgid-Bugs-To: docs@puppetlabs.com\n"
|
12
|
-
"POT-Creation-Date:
|
13
|
-
"PO-Revision-Date:
|
12
|
+
"POT-Creation-Date: 2022-02-07 21:13+0000\n"
|
13
|
+
"PO-Revision-Date: 2022-02-07 21:13+0000\n"
|
14
14
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
15
15
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
16
16
|
"Language: \n"
|
@@ -115,7 +115,7 @@ msgstr ""
|
|
115
115
|
msgid "%{class} has not implemented method %{method}"
|
116
116
|
msgstr ""
|
117
117
|
|
118
|
-
#: ../lib/r10k/environment/name.rb:
|
118
|
+
#: ../lib/r10k/environment/name.rb:83
|
119
119
|
msgid "Improper configuration value given for strip_component setting in %{src} source. Value must be a string, a /regex/, false, or omitted. Got \"%{val}\" (%{type})"
|
120
120
|
msgstr ""
|
121
121
|
|
@@ -395,27 +395,31 @@ msgstr ""
|
|
395
395
|
msgid "Module %{name} with args %{args} doesn't have an implementation. (Are you using the right arguments?)"
|
396
396
|
msgstr ""
|
397
397
|
|
398
|
-
#: ../lib/r10k/module/base.rb:
|
398
|
+
#: ../lib/r10k/module/base.rb:66
|
399
|
+
msgid "Overriding :exclude_spec setting with per module setting for #{@title}"
|
400
|
+
msgstr ""
|
401
|
+
|
402
|
+
#: ../lib/r10k/module/base.rb:87
|
399
403
|
msgid "Spec dir for #{@title} will not be deleted because it is not in the moduledir"
|
400
404
|
msgstr ""
|
401
405
|
|
402
|
-
#: ../lib/r10k/module/base.rb:
|
406
|
+
#: ../lib/r10k/module/base.rb:99
|
403
407
|
msgid "Deleting spec data at #{spec_path}"
|
404
408
|
msgstr ""
|
405
409
|
|
406
|
-
#: ../lib/r10k/module/base.rb:
|
410
|
+
#: ../lib/r10k/module/base.rb:107
|
407
411
|
msgid "No spec dir detected at #{spec_path}, skipping deletion"
|
408
412
|
msgstr ""
|
409
413
|
|
410
|
-
#: ../lib/r10k/module/base.rb:
|
414
|
+
#: ../lib/r10k/module/base.rb:120
|
411
415
|
msgid "Deploying module to %{path}"
|
412
416
|
msgstr ""
|
413
417
|
|
414
|
-
#: ../lib/r10k/module/base.rb:
|
418
|
+
#: ../lib/r10k/module/base.rb:123
|
415
419
|
msgid "Only updating modules %{modules}, skipping module %{name}"
|
416
420
|
msgstr ""
|
417
421
|
|
418
|
-
#: ../lib/r10k/module/base.rb:
|
422
|
+
#: ../lib/r10k/module/base.rb:179
|
419
423
|
msgid "Module name (%{title}) must match either 'modulename' or 'owner/modulename'"
|
420
424
|
msgstr ""
|
421
425
|
|
@@ -423,6 +427,10 @@ msgstr ""
|
|
423
427
|
msgid "Not updating module %{name}, assuming content unchanged"
|
424
428
|
msgstr ""
|
425
429
|
|
430
|
+
#: ../lib/r10k/module/forge.rb:50
|
431
|
+
msgid "Module version %{ver} is not a valid Forge module version"
|
432
|
+
msgstr ""
|
433
|
+
|
426
434
|
#: ../lib/r10k/module/forge.rb:98
|
427
435
|
msgid "The module %{title} does not appear to have any published releases, cannot determine latest version."
|
428
436
|
msgstr ""
|
@@ -435,7 +443,7 @@ msgstr ""
|
|
435
443
|
msgid "Forge module names must match 'owner/modulename', instead got #{title}"
|
436
444
|
msgstr ""
|
437
445
|
|
438
|
-
#: ../lib/r10k/module/git.rb:
|
446
|
+
#: ../lib/r10k/module/git.rb:79
|
439
447
|
msgid "Cannot track control repo branch for content '%{name}' when not part of a git-backed environment, will use default if available."
|
440
448
|
msgstr ""
|
441
449
|
|
@@ -479,11 +487,11 @@ msgstr ""
|
|
479
487
|
msgid "Puppetfile %{path} missing or unreadable"
|
480
488
|
msgstr ""
|
481
489
|
|
482
|
-
#: ../lib/r10k/module_loader/puppetfile.rb:
|
490
|
+
#: ../lib/r10k/module_loader/puppetfile.rb:230
|
483
491
|
msgid "Puppetfiles cannot contain duplicate module names."
|
484
492
|
msgstr ""
|
485
493
|
|
486
|
-
#: ../lib/r10k/module_loader/puppetfile.rb:
|
494
|
+
#: ../lib/r10k/module_loader/puppetfile.rb:232
|
487
495
|
msgid "Remove the duplicates of the following modules: %{dupes}"
|
488
496
|
msgstr ""
|
489
497
|
|
data/r10k.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.add_dependency 'gettext', ['>= 3.0.2', '< 3.3.0']
|
38
38
|
|
39
39
|
s.add_dependency 'jwt', '~> 2.2.3'
|
40
|
-
s.add_dependency 'minitar', '~> 0.9
|
40
|
+
s.add_dependency 'minitar', '~> 0.9'
|
41
41
|
|
42
42
|
s.add_development_dependency 'rspec', '~> 3.1'
|
43
43
|
|
@@ -33,21 +33,17 @@ describe R10K::Module::Forge do
|
|
33
33
|
|
34
34
|
describe "implementing the Puppetfile spec" do
|
35
35
|
it "should implement 'branan/eight_hundred', '8.0.0'" do
|
36
|
-
expect(described_class).to be_implement('branan/eight_hundred', { version: '8.0.0' })
|
36
|
+
expect(described_class).to be_implement('branan/eight_hundred', { type: 'forge', version: '8.0.0' })
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should implement 'branan-eight_hundred', '8.0.0'" do
|
40
|
-
expect(described_class).to be_implement('branan-eight_hundred', { version: '8.0.0' })
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should fail with an invalid title" do
|
44
|
-
expect(described_class).to_not be_implement('branan!eight_hundred', { version: '8.0.0' })
|
40
|
+
expect(described_class).to be_implement('branan-eight_hundred', { type: 'forge', version: '8.0.0' })
|
45
41
|
end
|
46
42
|
end
|
47
43
|
|
48
44
|
describe "implementing the standard options interface" do
|
49
45
|
it "should implement {type: forge}" do
|
50
|
-
expect(described_class).to be_implement('branan-eight_hundred', {type: 'forge', version: '8.0.0', source: 'not implemented'})
|
46
|
+
expect(described_class).to be_implement('branan-eight_hundred', { type: 'forge', version: '8.0.0', source: 'not implemented' })
|
51
47
|
end
|
52
48
|
end
|
53
49
|
|
@@ -71,6 +67,12 @@ describe R10K::Module::Forge do
|
|
71
67
|
end
|
72
68
|
end
|
73
69
|
|
70
|
+
describe "invalid attributes" do
|
71
|
+
it "errors on invalid versions" do
|
72
|
+
expect { described_class.new('branan/eight_hundred', '/moduledir', { version: '_8.0.0_' }) }.to raise_error ArgumentError, /version/
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
74
76
|
describe "properties" do
|
75
77
|
subject { described_class.new('branan/eight_hundred', fixture_modulepath, { version: '8.0.0' }) }
|
76
78
|
|
@@ -80,7 +80,8 @@ describe R10K::ModuleLoader::Puppetfile do
|
|
80
80
|
describe 'adding modules' do
|
81
81
|
let(:basedir) { '/test/basedir' }
|
82
82
|
|
83
|
-
subject { R10K::ModuleLoader::Puppetfile.new(basedir: basedir
|
83
|
+
subject { R10K::ModuleLoader::Puppetfile.new(basedir: basedir,
|
84
|
+
overrides: {modules: {exclude_spec: true}}) }
|
84
85
|
|
85
86
|
it 'should transform Forge modules with a string arg to have a version key' do
|
86
87
|
expect(R10K::Module).to receive(:from_metadata).with('puppet/test_module', subject.moduledir, hash_including(version: '1.2.3'), anything).and_call_original
|
@@ -94,11 +95,23 @@ describe R10K::ModuleLoader::Puppetfile do
|
|
94
95
|
|
95
96
|
expect {
|
96
97
|
subject.add_module('puppet/test_module', '< 1.2.0')
|
97
|
-
}.to raise_error(
|
98
|
+
}.to raise_error(ArgumentError, /module version .* is not a valid forge module version/i)
|
98
99
|
|
99
100
|
expect(subject.modules.collect(&:name)).not_to include('test_module')
|
100
101
|
end
|
101
102
|
|
103
|
+
it 'should not modify the overrides when adding modules' do
|
104
|
+
module_opts = { git: 'git@example.com:puppet/test_module.git' }
|
105
|
+
subject.add_module('puppet/test_module', module_opts)
|
106
|
+
expect(subject.instance_variable_get("@overrides")[:modules]).to eq({exclude_spec: true})
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'should read the `exclude_spec` setting in the module definition and override the overrides' do
|
110
|
+
module_opts = { git: 'git@example.com:puppet/test_module.git', exclude_spec: false }
|
111
|
+
subject.add_module('puppet/test_module', module_opts)
|
112
|
+
expect(subject.modules[0].instance_variable_get("@exclude_spec")).to be false
|
113
|
+
end
|
114
|
+
|
102
115
|
it 'should set :spec_deletable to true for modules in the basedir' do
|
103
116
|
module_opts = { git: 'git@example.com:puppet/test_module.git' }
|
104
117
|
subject.add_module('puppet/test_module', module_opts)
|
data/spec/unit/module_spec.rb
CHANGED
@@ -31,12 +31,11 @@ describe R10K::Module do
|
|
31
31
|
'bar-quux',
|
32
32
|
].each do |scenario|
|
33
33
|
it "accepts a name matching #{scenario} and version nil" do
|
34
|
-
obj = R10K::Module.new(scenario, '/modulepath', { version: nil })
|
34
|
+
obj = R10K::Module.new(scenario, '/modulepath', { type: 'forge', version: nil })
|
35
35
|
expect(obj).to be_a_kind_of(R10K::Module::Forge)
|
36
36
|
end
|
37
37
|
end
|
38
|
-
[ {version: '8.0.0'},
|
39
|
-
{type: 'forge', version: '8.0.0'},
|
38
|
+
[ {type: 'forge', version: '8.0.0'},
|
40
39
|
].each do |scenario|
|
41
40
|
it "accepts a name matching bar-quux and args #{scenario.inspect}" do
|
42
41
|
obj = R10K::Module.new('bar-quux', '/modulepath', scenario)
|
@@ -65,7 +64,7 @@ describe R10K::Module do
|
|
65
64
|
end
|
66
65
|
|
67
66
|
it 'sets the expected version to what is found in the metadata' do
|
68
|
-
obj = R10K::Module.new(@title, @dirname, {version: nil})
|
67
|
+
obj = R10K::Module.new(@title, @dirname, {type: 'forge', version: nil})
|
69
68
|
expect(obj.send(:instance_variable_get, :'@expected_version')).to eq('1.2.0')
|
70
69
|
end
|
71
70
|
end
|
@@ -82,7 +81,6 @@ describe R10K::Module do
|
|
82
81
|
['name', {type: 'git', source: 'git url'}],
|
83
82
|
['name', {svn: 'svn url'}],
|
84
83
|
['name', {type: 'svn', source: 'svn url'}],
|
85
|
-
['namespace-name', {version: '8.0.0'}],
|
86
84
|
['namespace-name', {type: 'forge', version: '8.0.0'}]
|
87
85
|
].each do |(name, options)|
|
88
86
|
it 'can handle the default_branch_override option' do
|
@@ -92,12 +90,21 @@ describe R10K::Module do
|
|
92
90
|
}.not_to raise_error
|
93
91
|
end
|
94
92
|
describe 'the exclude_spec setting' do
|
93
|
+
it 'sets the exclude_spec instance variable to false by default' do
|
94
|
+
obj = R10K::Module.new(name, '/modulepath', options)
|
95
|
+
expect(obj.instance_variable_get("@exclude_spec")).to eq(false)
|
96
|
+
end
|
95
97
|
it 'sets the exclude_spec instance variable' do
|
96
98
|
obj = R10K::Module.new(name, '/modulepath', options.merge({exclude_spec: true}))
|
97
99
|
expect(obj.instance_variable_get("@exclude_spec")).to eq(true)
|
98
100
|
end
|
99
|
-
it '
|
100
|
-
options = options.merge({exclude_spec:
|
101
|
+
it 'cannot be overridden by the settings from the cli, r10k.yaml, or settings default' do
|
102
|
+
options = options.merge({exclude_spec: true, overrides: {modules: {exclude_spec: false}}})
|
103
|
+
obj = R10K::Module.new(name, '/modulepath', options)
|
104
|
+
expect(obj.instance_variable_get("@exclude_spec")).to eq(true)
|
105
|
+
end
|
106
|
+
it 'reads the setting from the cli, r10k.yaml, or settings default when not provided directly' do
|
107
|
+
options = options.merge({overrides: {modules: {exclude_spec: true}}})
|
101
108
|
obj = R10K::Module.new(name, '/modulepath', options)
|
102
109
|
expect(obj.instance_variable_get("@exclude_spec")).to eq(true)
|
103
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r10k
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.14.
|
4
|
+
version: 3.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Thebo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored2
|
@@ -148,14 +148,14 @@ dependencies:
|
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: 0.9
|
151
|
+
version: '0.9'
|
152
152
|
type: :runtime
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: 0.9
|
158
|
+
version: '0.9'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: rspec
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|