r10k 2.4.1 → 2.4.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 641a17c6593ee322ad99118d6cb4417bcf60dcee
4
- data.tar.gz: 152e586e81392f906185e3bbf26c7ea4ef3d2e53
3
+ metadata.gz: 487d95e761e476a0701e43c1a36a146b977a5ed5
4
+ data.tar.gz: a05e79eadd63370717d5c766b94868a732117889
5
5
  SHA512:
6
- metadata.gz: b841c5c9f5257fe8c737982b367cc047478d643c93a02158603dfd556b534010d7f323ade0c85e7726af9c8ee48d07d065ab68c856a399ce740c6eb6c325d6db
7
- data.tar.gz: 64ca0499ceb9b51b6ab9c3b5695f8bf9d935e0b0737fdac186372e98cf463c53ec823d053f99aed3fcb7e9a63c5f5ed9376055f5f6164d5213cfa6a1a8e1e50b
6
+ metadata.gz: a4ae1bfa5022c9660acecf7953114c1d76e148283cc5d1a1048930a1c56be7b8492b9a07c16ac66ee8a056d69b4b1cdce9272e4485070ba738f16d59acb29ef7
7
+ data.tar.gz: 4e522d29f6cd877388748c871144763b258cee2afffe0ac2221c2cbbfdf3f1cb0f7bf415466a0b2725e8519787ef3abdc4e50f81906ab46ded0cd65853444807
@@ -1,6 +1,38 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 2.4.3
5
+ -----
6
+
7
+ 2016/08/23
8
+
9
+ ### Bug Fixes
10
+
11
+ (RK-266) Fixed an issue where the "puppetfile install" action was encountering an
12
+ error when operating on a Puppetfile with "local" content declarations.
13
+
14
+ 2.4.2 (Yanked)
15
+ --------------
16
+
17
+ 2016/08/22
18
+
19
+ ### Bug Fixes
20
+
21
+ (RK-265) The "puppetfile install" action will no longer overwrite local
22
+ modifications to managed Git content. Instead, a message will be logged at the
23
+ "WARN" level indicating that the content was skipped. Note: The "deploy"
24
+ actions will still overwrite local modications. For more background on this
25
+ change, see below:
26
+
27
+ In 2.4.0 a change was made to r10k's behavior when it encounters local
28
+ modifications during "deploy" operations. Previously, r10k would log an error
29
+ and skip updating the modified content. As of 2.4.0, local modifications will
30
+ be overwritten and a warning will be logged. This change was considered a bug
31
+ fix but was originally omitted from the changelog for that release. This change
32
+ also inadvertently modified the behavior of the "puppetfile install" action. A
33
+ command line flag to control this behavior more explicitly will likely be added
34
+ in a future version.
35
+
4
36
  2.4.1
5
37
  -----
6
38
 
@@ -51,6 +83,11 @@ iternationalization (i18n) and localization work.
51
83
  This situation used to raise an error but will now generate a WARN level log message
52
84
  instead.
53
85
 
86
+ (#483) Local modifications to managed content will now be overwritten during "deploy"
87
+ actions. (Note: This change inadvertently also affected the "puppetfile install"
88
+ action in 2.4.0 and 2.4.1. This was fixed in 2.4.2. A command line flag to control
89
+ this behavior more explicitly will likely be added in a future version.)
90
+
54
91
  ### Bug Fixes
55
92
 
56
93
  (#616) Ensure that Forge module version strings are valid semantic versions. (Special
@@ -27,7 +27,7 @@ module R10K
27
27
 
28
28
  def visit_module(mod)
29
29
  logger.info _("Updating module %{mod_path}") % {mod_path: mod.path}
30
- mod.sync
30
+ mod.sync(force: false) # Don't force sync for 'puppetfile install' RK-265
31
31
  end
32
32
 
33
33
  def allowed_initialize_opts
@@ -31,7 +31,7 @@ class R10K::Git::StatefulRepository
31
31
  @cache.resolve(ref)
32
32
  end
33
33
 
34
- def sync(ref)
34
+ def sync(ref, force=true)
35
35
  @cache.sync if sync_cache?(ref)
36
36
 
37
37
  sha = @cache.resolve(ref)
@@ -44,21 +44,25 @@ class R10K::Git::StatefulRepository
44
44
 
45
45
  case workdir_status
46
46
  when :absent
47
- logger.debug { _("Cloning %{repo_path} and checking out %{ref}") % {repo_path: @repo.path, ref: ref } }
47
+ logger.debug(_("Cloning %{repo_path} and checking out %{ref}") % {repo_path: @repo.path, ref: ref })
48
48
  @repo.clone(@remote, {:ref => sha})
49
49
  when :mismatched
50
- logger.debug { _("Replacing %{repo_path} and checking out %{ref}") % {repo_path: @repo.path, ref: ref } }
50
+ logger.debug(_("Replacing %{repo_path} and checking out %{ref}") % {repo_path: @repo.path, ref: ref })
51
51
  @repo.path.rmtree
52
52
  @repo.clone(@remote, {:ref => sha})
53
- when :outdated, :dirty
54
- if workdir_status == :dirty
55
- logger.warn { _("%{repo_path} has local modifications which will be overwritten") % {repo_path: @repo.path} }
53
+ when :outdated
54
+ logger.debug(_("Updating %{repo_path} to %{ref}") % {repo_path: @repo.path, ref: ref })
55
+ @repo.checkout(sha, {:force => force})
56
+ when :dirty
57
+ if force
58
+ logger.warn(_("Overwriting local modifications to %{repo_path}") % {repo_path: @repo.path})
59
+ logger.debug(_("Updating %{repo_path} to %{ref}") % {repo_path: @repo.path, ref: ref })
60
+ @repo.checkout(sha, {:force => force})
61
+ else
62
+ logger.warn(_("Skipping %{repo_path} due to local modifications") % {repo_path: @repo.path})
56
63
  end
57
-
58
- logger.debug { _("Updating %{repo_path} to %{ref}") % {repo_path: @repo.path, ref: ref } }
59
- @repo.checkout(sha, {:force => true})
60
64
  else
61
- logger.debug { _("%{repo_path} is already at Git ref %{ref}") % {repo_path: @repo.path, ref: ref } }
65
+ logger.debug(_("%{repo_path} is already at Git ref %{ref}") % {repo_path: @repo.path, ref: ref })
62
66
  end
63
67
  end
64
68
 
@@ -71,12 +75,12 @@ class R10K::Git::StatefulRepository
71
75
  :mismatched
72
76
  elsif !(@repo.origin == @remote)
73
77
  :mismatched
78
+ elsif @repo.dirty?
79
+ :dirty
74
80
  elsif !(@repo.head == @cache.resolve(ref))
75
81
  :outdated
76
82
  elsif @cache.ref_type(ref) == :branch && !@cache.synced?
77
83
  :outdated
78
- elsif @repo.dirty?
79
- :dirty
80
84
  else
81
85
  :insync
82
86
  end
@@ -53,7 +53,7 @@ class R10K::Module::Base
53
53
 
54
54
  # Synchronize this module with the indicated state.
55
55
  # @abstract
56
- def sync
56
+ def sync(opts={})
57
57
  raise NotImplementedError
58
58
  end
59
59
 
@@ -42,7 +42,7 @@ class R10K::Module::Forge < R10K::Module::Base
42
42
  @v3_module = PuppetForge::V3::Module.new(:slug => @title)
43
43
  end
44
44
 
45
- def sync(options = {})
45
+ def sync(opts={})
46
46
  case status
47
47
  when :absent
48
48
  install
@@ -38,8 +38,9 @@ class R10K::Module::Git < R10K::Module::Base
38
38
  }
39
39
  end
40
40
 
41
- def sync
42
- @repo.sync(version)
41
+ def sync(opts={})
42
+ force = opts && opts.fetch(:force, true)
43
+ @repo.sync(version, force)
43
44
  end
44
45
 
45
46
  def status
@@ -30,7 +30,7 @@ class R10K::Module::Local < R10K::Module::Base
30
30
  :insync
31
31
  end
32
32
 
33
- def sync
33
+ def sync(opts={})
34
34
  logger.debug1 _("Module %{title} is a local module, always indicating synced.") % {title: title}
35
35
  end
36
36
  end
@@ -66,7 +66,7 @@ class R10K::Module::SVN < R10K::Module::Base
66
66
  end
67
67
  end
68
68
 
69
- def sync
69
+ def sync(opts={})
70
70
  case status
71
71
  when :absent
72
72
  install
@@ -1,3 +1,3 @@
1
1
  module R10K
2
- VERSION = '2.4.1'
2
+ VERSION = '2.4.3'
3
3
  end
@@ -68,12 +68,19 @@ describe R10K::Git::StatefulRepository do
68
68
  end
69
69
 
70
70
  describe "when the workdir has local modifications" do
71
- it "is dirty" do
71
+ it "is dirty when workdir is up to date" do
72
72
  thinrepo.clone(remote, {:ref => ref})
73
73
  File.open(File.join(thinrepo.path, 'README.markdown'), 'a') { |f| f.write('local modifications!') }
74
74
 
75
75
  expect(subject.status(ref)).to eq :dirty
76
76
  end
77
+
78
+ it "is dirty when workdir is not up to date" do
79
+ thinrepo.clone(remote, {:ref => '1.0.0'})
80
+ File.open(File.join(thinrepo.path, 'README.markdown'), 'a') { |f| f.write('local modifications!') }
81
+
82
+ expect(subject.status(ref)).to eq :dirty
83
+ end
77
84
  end
78
85
 
79
86
  describe "if the right ref is checked out" do
@@ -119,11 +126,33 @@ describe R10K::Git::StatefulRepository do
119
126
  end
120
127
 
121
128
  describe "when the workdir is dirty" do
122
- it "overwrites local modificatios" do
129
+ before(:each) do
123
130
  thinrepo.clone(remote, {:ref => ref})
124
131
  File.open(File.join(thinrepo.path, 'README.markdown'), 'a') { |f| f.write('local modifications!') }
125
- subject.sync(ref)
126
- expect(subject.status(ref)).to eq :insync
132
+ end
133
+
134
+ context "when force == true" do
135
+ let(:force) { true }
136
+
137
+ it "warns and overwrites local modifications" do
138
+ expect(subject.logger).to receive(:warn).with(/overwriting local modifications/i)
139
+
140
+ subject.sync(ref, force)
141
+
142
+ expect(subject.status(ref)).to eq :insync
143
+ end
144
+ end
145
+
146
+ context "when force != true" do
147
+ let(:force) { false }
148
+
149
+ it "warns and does not overwrite local modifications" do
150
+ expect(subject.logger).to receive(:warn).with(/skipping.*due to local modifications/i)
151
+
152
+ subject.sync(ref, force)
153
+
154
+ expect(subject.status(ref)).to eq :dirty
155
+ end
127
156
  end
128
157
  end
129
158
  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: 2.4.1
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-11 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored