puppet 4.2.2-x64-mingw32 → 4.2.3-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

@@ -106,7 +106,7 @@ a ticket number.
106
106
 
107
107
  # Additional Resources
108
108
 
109
- * [Puppet Labs community guildelines](http://docs.puppetlabs.com/community/community_guidelines.html)
109
+ * [Puppet Labs community guidelines](http://docs.puppetlabs.com/community/community_guidelines.html)
110
110
  * [Bug tracker (Jira)](http://tickets.puppetlabs.com)
111
111
  * [Contributor License Agreement](http://links.puppetlabs.com/cla)
112
112
  * [General GitHub documentation](http://help.github.com/)
data/Gemfile CHANGED
@@ -62,12 +62,7 @@ group(:extra) do
62
62
  gem "net-ssh", '~> 2.1', :require => false
63
63
  gem "puppetlabs_spec_helper", :require => false
64
64
  gem "tzinfo", :require => false
65
- case RUBY_PLATFORM
66
- when 'java'
67
- gem "msgpack-jruby", :require => false
68
- else
69
- gem "msgpack", :require => false
70
- end
65
+ gem "msgpack", :require => false
71
66
  end
72
67
 
73
68
  require 'yaml'
@@ -18,8 +18,10 @@ export PATH
18
18
 
19
19
  [ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
20
20
  lockfile=/var/lock/subsys/puppet
21
- pidfile=/var/run/puppetlabs/agent.pid
21
+ piddir=/var/run/puppetlabs
22
+ pidfile=${piddir}/agent.pid
22
23
  puppetd=/opt/puppetlabs/puppet/bin/puppet
24
+ pid=$(cat $pidfile 2> /dev/null)
23
25
  RETVAL=0
24
26
 
25
27
  PUPPET_OPTS="agent "
@@ -29,6 +31,7 @@ PUPPET_OPTS="agent "
29
31
  if status | grep -q -- '-p' 2>/dev/null; then
30
32
  daemonopts="--pidfile $pidfile"
31
33
  pidopts="-p $pidfile"
34
+ USEINITFUNCTIONS=true
32
35
  fi
33
36
 
34
37
  # Figure out if the system just booted. Let's assume
@@ -38,6 +41,7 @@ fi
38
41
 
39
42
  start() {
40
43
  echo -n $"Starting puppet agent: "
44
+ mkdir -p $piddir
41
45
  daemon $daemonopts $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS}
42
46
  RETVAL=$?
43
47
  echo
@@ -47,16 +51,33 @@ start() {
47
51
 
48
52
  stop() {
49
53
  echo -n $"Stopping puppet agent: "
50
- killproc $pidopts $puppetd
51
- RETVAL=$?
54
+ if [ "$USEINITFUNCTIONS" = "true" ]; then
55
+ killproc $pidopts $puppetd
56
+ RETVAL=$?
57
+ else
58
+ if [ -n "${pid}" ]; then
59
+ kill -TERM $pid >/dev/null 2>&1
60
+ RETVAL=$?
61
+ fi
62
+ fi
52
63
  echo
53
64
  [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
65
+ return $RETVAL
54
66
  }
55
67
 
56
68
  reload() {
57
69
  echo -n $"Restarting puppet agent: "
58
- killproc $pidopts $puppetd -HUP
59
- RETVAL=$?
70
+ if [ "$USEINITFUNCTIONS" = "true" ]; then
71
+ killproc $pidopts $puppetd -HUP
72
+ RETVAL=$?
73
+ else
74
+ if [ -n "${pid}" ]; then
75
+ kill -HUP $pid >/dev/null 2>&1
76
+ RETVAL=$?
77
+ else
78
+ RETVAL=0
79
+ fi
80
+ fi
60
81
  echo
61
82
  return $RETVAL
62
83
  }
@@ -67,9 +88,33 @@ restart() {
67
88
  }
68
89
 
69
90
  rh_status() {
70
- status $pidopts $puppetd
71
- RETVAL=$?
72
- return $RETVAL
91
+ base=puppet
92
+ if [ "$USEINITFUNCTIONS" = "true" ]; then
93
+ status $pidopts $puppetd
94
+ RETVAL=$?
95
+ return $RETVAL
96
+ else
97
+ if [ -n "${pid}" ]; then
98
+ if `ps -p $pid | grep $pid > /dev/null 2>&1`; then
99
+ echo "${base} (pid ${pid}) is running..."
100
+ RETVAL=0
101
+ return $RETVAL
102
+ fi
103
+ fi
104
+ if [ -f "${pidfile}" ] ; then
105
+ echo "${base} dead but pid file exists"
106
+ RETVAL=1
107
+ return $RETVAL
108
+ fi
109
+ if [ -f "${lockfile}" ]; then
110
+ echo "${base} dead but subsys locked"
111
+ RETVAL=2
112
+ return $RETVAL
113
+ fi
114
+ echo "${base} is stopped"
115
+ RETVAL=3
116
+ return $RETVAL
117
+ fi
73
118
  }
74
119
 
75
120
  rh_status_q() {
@@ -73,7 +73,7 @@ case "$1" in
73
73
  rc_exit
74
74
  fi
75
75
  fi
76
- startproc -f -w -p "${pidfile}" "${puppetd}" "${PUPPET_OPTS}" "${PUPPET_EXTRA_OPTS}" && touch "${lockfile}"
76
+ startproc -f -w -p "${pidfile}" "${puppetd}" "${PUPPET_OPTS}" ${PUPPET_EXTRA_OPTS} && touch "${lockfile}"
77
77
  # Remember status and be verbose
78
78
  rc_status -v
79
79
  ;;
@@ -104,22 +104,9 @@ case "$1" in
104
104
  # Remember status and be quiet
105
105
  rc_status
106
106
  ;;
107
- force-reload)
108
- ## Signal the daemon to reload its config. Most daemons
109
- ## do this on signal 1 (SIGHUP).
110
- ## If it does not support it, restart.
111
-
112
- echo -n "Reload service puppet"
113
- ## if it supports it:
114
- killproc -HUP -p "${pidfile}" "${puppetd}"
115
- rc_status -v
116
- ;;
117
- reload)
118
- ## Like force-reload, but if daemon does not support
119
- ## signalling, do nothing (!)
120
-
121
- # If it supports signalling:
122
- echo -n "Reload puppet services."
107
+ reload|force-reload)
108
+ # Reload the service by sending the HUP signal
109
+ echo -n "Reloading puppet service: "
123
110
  killproc -HUP -p "${pidfile}" "${puppetd}"
124
111
  rc_status -v
125
112
  ;;
@@ -145,7 +132,7 @@ case "$1" in
145
132
  ;;
146
133
  once)
147
134
  shift
148
- $puppetd "${PUPPET_OPTS}" --onetime "${PUPPET_EXTRA_OPTS}" $@
135
+ $puppetd "${PUPPET_OPTS}" --onetime ${PUPPET_EXTRA_OPTS} $@
149
136
  ;;
150
137
  *)
151
138
  echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload|once}"
@@ -118,14 +118,14 @@ go into the background, attempt to get a signed certificate, and retrieve
118
118
  and apply its configuration every 30 minutes.
119
119
 
120
120
  Some flags are meant specifically for interactive use -- in particular,
121
- 'test', 'tags' or 'fingerprint' are useful. 'test' enables verbose
122
- logging, causes the daemon to stay in the foreground, exits if the
123
- server's configuration is invalid (this happens if, for instance, you've
124
- left a syntax error on the server), and exits after running the
125
- configuration once (rather than hanging around as a long-running
126
- process).
127
-
128
- 'tags' allows you to specify what portions of a configuration you want
121
+ 'test', 'tags' and 'fingerprint' are useful.
122
+
123
+ '--test' does a single run in the foreground with verbose logging, then exits.
124
+ It will also exit if it can't get a valid catalog. The exit code after running
125
+ with '--test' is 0 if the catalog was successfully applied, and 1 if the run
126
+ either failed or wasn't attempted (due to another run already in progress).
127
+
128
+ '--tags' allows you to specify what portions of a configuration you want
129
129
  to apply. Puppet elements are tagged with all of the class or definition
130
130
  names that contain them, and you can use the 'tags' flag to specify one
131
131
  of these names, causing only configuration elements contained within
@@ -136,7 +136,7 @@ class, and call puppet with '--tags ntpd', which would only apply that
136
136
  small portion of the configuration during your testing, rather than
137
137
  applying the whole thing.
138
138
 
139
- 'fingerprint' is a one-time flag. In this mode 'puppet agent' will run
139
+ '--fingerprint' is a one-time flag. In this mode 'puppet agent' will run
140
140
  once and display on the console (and in the log) the current certificate
141
141
  (or certificate request) fingerprint. Providing the '--digest' option
142
142
  allows to use a different digest algorithm to generate the fingerprint.
@@ -181,14 +181,14 @@ generated by running puppet agent with '--genconfig'.
181
181
  Enable full debugging.
182
182
 
183
183
  * --detailed-exitcodes:
184
- Provide extra information about the run via exit codes; only works if
185
- '--onetime' is also specified. If enabled, 'puppet agent' will use the
184
+ Provide extra information about the run via exit codes; only works if '--test'
185
+ or '--onetime' is also specified. If enabled, 'puppet agent' will use the
186
186
  following exit codes:
187
187
 
188
188
  0: The run succeeded with no changes or failures; the system was already in
189
189
  the desired state.
190
190
 
191
- 1: The run failed.
191
+ 1: The run failed, or wasn't attempted due to another run already in progress.
192
192
 
193
193
  2: The run succeeded, and some resources were changed.
194
194
 
@@ -198,7 +198,8 @@ Copyright (c) 2012 Puppet Labs, LLC Licensed under the Apache 2.0 License
198
198
  exit(39)
199
199
  end
200
200
  else
201
- raise Puppet::Error.new("Could not change user to #{Puppet[:user]}. User does not exist and is required to continue.")
201
+ Puppet.err("Could not change user to #{Puppet[:user]}. User does not exist and is required to continue.")
202
+ exit(74)
202
203
  end
203
204
  end
204
205
 
@@ -38,6 +38,9 @@ module Puppet::Environments
38
38
  raise EnvironmentNotFound, name
39
39
  end
40
40
  end
41
+
42
+ def clear_all
43
+ end
41
44
  end
42
45
 
43
46
  # @!macro [new] loader_search_paths
@@ -193,12 +196,13 @@ module Puppet::Environments
193
196
  def create_environment(name)
194
197
  env_symbol = name.intern
195
198
  setting_values = Puppet.settings.values(env_symbol, Puppet.settings.preferred_run_mode)
196
- Puppet::Node::Environment.create(
199
+ env = Puppet::Node::Environment.create(
197
200
  env_symbol,
198
201
  Puppet::Node::Environment.split_path(setting_values.interpolate(:modulepath)),
199
202
  setting_values.interpolate(:manifest),
200
203
  setting_values.interpolate(:config_version)
201
204
  )
205
+ env
202
206
  end
203
207
 
204
208
  def valid_directory?(envdir)
@@ -257,6 +261,9 @@ module Puppet::Environments
257
261
  nil
258
262
  end
259
263
 
264
+ def clear_all
265
+ @loaders.each {|loader| loader.clear_all}
266
+ end
260
267
  end
261
268
 
262
269
  class Cached
@@ -356,6 +363,7 @@ module Puppet::Environments
356
363
  # Clears all cached environments.
357
364
  # (The intention is that this could be used from a MANUAL cache eviction command (TBD)
358
365
  def clear_all()
366
+ super
359
367
  @cache = {}
360
368
  @expirations.clear
361
369
  @next_expiration = END_OF_TIME
@@ -55,14 +55,14 @@ Puppet::Functions.create_function(:filter) do
55
55
  end
56
56
 
57
57
  def filter_Hash_1(hash)
58
- result = hash.select {|x, y| yield([x, y]) }
58
+ result = hash.select {|x, y| yield([x, y]) == true }
59
59
  # Ruby 1.8.7 returns Array
60
60
  result = Hash[result] unless result.is_a? Hash
61
61
  result
62
62
  end
63
63
 
64
64
  def filter_Hash_2(hash)
65
- result = hash.select {|x, y| yield(x, y) }
65
+ result = hash.select {|x, y| yield(x, y) == true }
66
66
  # Ruby 1.8.7 returns Array
67
67
  result = Hash[result] unless result.is_a? Hash
68
68
  result
@@ -196,7 +196,12 @@ class Puppet::Indirector::Indirection
196
196
  result.expiration ||= self.expiration if result.respond_to?(:expiration)
197
197
  if cache?
198
198
  Puppet.info "Caching #{self.name} for #{request.key}"
199
- cache.save request(:save, key, result, options)
199
+ begin
200
+ cache.save request(:save, key, result, options)
201
+ rescue => detail
202
+ Puppet.log_exception(detail)
203
+ raise detail
204
+ end
200
205
  end
201
206
 
202
207
  filtered = result
@@ -87,7 +87,7 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
87
87
  version = nil
88
88
  showres_command << "'#{Regexp.escape(pkg)}'"
89
89
  end
90
- output = Puppet::Util.execute(showres_command)
90
+ output = Puppet::Util::Execution.execute(showres_command)
91
91
 
92
92
 
93
93
  if (version_specified)
@@ -219,15 +219,16 @@ class Puppet::Settings::FileSetting < Puppet::Settings::StringSetting
219
219
  Puppet::Util::SUIDManager.asuser(*chown) do
220
220
  # Update the umask to make non-executable files
221
221
  Puppet::Util.withumask(File.umask ^ 0111) do
222
- mode = case mode.class
223
- when String
224
- mode.to_i(8)
225
- when NilClass
226
- 0640
227
- else
228
- mode
229
- end
230
- yield mode
222
+ yielded_value = case self.mode
223
+ when String
224
+ self.mode.to_i(8)
225
+ when NilClass
226
+ 0640
227
+ else
228
+ self.mode
229
+ end
230
+
231
+ yield yielded_value
231
232
  end
232
233
  end
233
234
  end
@@ -372,6 +372,10 @@ class Puppet::Transaction
372
372
  not resource.tagged?(*tags)
373
373
  end
374
374
 
375
+ def split_qualified_tags?
376
+ false
377
+ end
378
+
375
379
  # These two methods are only made public to enable the existing spec tests to run
376
380
  # under rspec 3 (apparently rspec 2 didn't enforce access controls?). Please do not
377
381
  # treat these as part of a public API.
@@ -18,8 +18,10 @@ module Puppet::Util::Tagging
18
18
  if @tags.add?(name)
19
19
  # not seen before, so now we test if it is valid
20
20
  if name =~ ValidTagRegex
21
+ if split_qualified_tags?
21
22
  # avoid adding twice by first testing if the string contains '::'
22
- @tags.merge(name.split('::')) if name.include?('::')
23
+ @tags.merge(name.split('::')) if name.include?('::')
24
+ end
23
25
  else
24
26
  @tags.delete(name)
25
27
  fail(Puppet::ParseError, "Invalid tag '#{name}'")
@@ -106,6 +108,10 @@ module Puppet::Util::Tagging
106
108
 
107
109
  private
108
110
 
111
+ def split_qualified_tags?
112
+ true
113
+ end
114
+
109
115
  def new_tags
110
116
  Puppet::Util::TagSet.new
111
117
  end
@@ -214,8 +214,11 @@ module Puppet::Util::Windows::ADSI
214
214
  end
215
215
 
216
216
  def password=(password)
217
- native_user.SetPassword(password)
218
- commit
217
+ if !password.nil?
218
+ native_user.SetPassword(password)
219
+ commit
220
+ end
221
+
219
222
  fADS_UF_DONT_EXPIRE_PASSWD = 0x10000
220
223
  add_flag("UserFlags", fADS_UF_DONT_EXPIRE_PASSWD)
221
224
  end
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '4.2.2'
10
+ PUPPETVERSION = '4.2.3'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -333,8 +333,8 @@ describe Puppet::Application::Master, :unless => Puppet.features.microsoft_windo
333
333
  it "should exit and log an error if running as root and the puppet user does not exist" do
334
334
  Puppet.features.stubs(:root?).returns true
335
335
  a_user_type_for("puppet").expects(:exists?).returns false
336
-
337
- expect { @master.main }.to raise_error(Puppet::Error, /Could not change user to puppet\. User does not exist and is required to continue\./)
336
+ Puppet.expects(:err).with('Could not change user to puppet. User does not exist and is required to continue.')
337
+ expect { @master.main }.to exit_with 74
338
338
  end
339
339
  end
340
340
 
@@ -122,6 +122,24 @@ describe 'the filter method' do
122
122
  expect(catalog).to have_resource("File[/file_blueb]").with_parameter(:ensure, 'present')
123
123
  end
124
124
 
125
+ it 'filters on an array will not include elements for which the block returns truthy but not true' do
126
+ catalog = compile_to_catalog(<<-MANIFEST)
127
+ $r = [1, 2, 3].filter |$v| { $v } == []
128
+ notify { "eval_${$r}": }
129
+ MANIFEST
130
+
131
+ expect(catalog).to have_resource('Notify[eval_true]')
132
+ end
133
+
134
+ it 'filters on a hash will not include elements for which the block returns truthy but not true' do
135
+ catalog = compile_to_catalog(<<-MANIFEST)
136
+ $r = {a => 1, b => 2, c => 3}.filter |$k, $v| { $v } == {}
137
+ notify { "eval_${$r}": }
138
+ MANIFEST
139
+
140
+ expect(catalog).to have_resource('Notify[eval_true]')
141
+ end
142
+
125
143
  it_should_behave_like 'all iterative functions argument checks', 'filter'
126
144
  it_should_behave_like 'all iterative functions hash handling', 'filter'
127
145
  end
@@ -393,6 +393,17 @@ describe Puppet::Indirector::Indirection do
393
393
 
394
394
  @indirection.find("/my/key")
395
395
  end
396
+
397
+ it "should fail if saving to the cache fails but log the exception" do
398
+ @cache.stubs(:find).returns nil
399
+
400
+ @terminus.stubs(:find).returns(@instance)
401
+ @cache.stubs(:save).raises RuntimeError
402
+
403
+ Puppet.expects(:log_exception)
404
+
405
+ expect { @indirection.find("/my/key") }.to raise_error
406
+ end
396
407
  end
397
408
  end
398
409
 
@@ -50,7 +50,7 @@ END
50
50
  it "should install a package" do
51
51
 
52
52
  @resource.stubs(:should).with(:ensure).returns(:installed)
53
- Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo'").returns(bff_showres_output)
53
+ Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo'").returns(bff_showres_output)
54
54
  @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo 1.2.3.8")
55
55
  @provider.install
56
56
  end
@@ -61,7 +61,7 @@ END
61
61
  nimclient_showres_output = ""
62
62
 
63
63
  @resource.stubs(:should).with(:ensure).returns("1.2.3.4")
64
- Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.4'").returns(nimclient_showres_output)
64
+ Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.4'").returns(nimclient_showres_output)
65
65
  expect {
66
66
  @provider.install
67
67
  }.to raise_error(Puppet::Error, "Unable to find package 'mypackage.foo' with version '1.2.3.4' on lpp_source 'mysource'")
@@ -71,7 +71,7 @@ END
71
71
  nimclient_sequence = sequence('nimclient')
72
72
 
73
73
  @resource.stubs(:should).with(:ensure).returns("1.2.3.4")
74
- Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.4'").returns(bff_showres_output).in_sequence(nimclient_sequence)
74
+ Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.4'").returns(bff_showres_output).in_sequence(nimclient_sequence)
75
75
  @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo 1.2.3.4").in_sequence(nimclient_sequence)
76
76
  @provider.install
77
77
  end
@@ -125,7 +125,7 @@ mypackage.foo 1.2.3.1 Already superseded by 1.2.3.4
125
125
  OUTPUT
126
126
 
127
127
  @resource.stubs(:should).with(:ensure).returns("1.2.3.1")
128
- Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.1'").returns(bff_showres_output).in_sequence(nimclient_sequence)
128
+ Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.1'").returns(bff_showres_output).in_sequence(nimclient_sequence)
129
129
  @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo 1.2.3.1").in_sequence(nimclient_sequence).returns(install_output)
130
130
 
131
131
  expect { @provider.install }.to raise_error(Puppet::Error, "NIM package provider is unable to downgrade packages")
@@ -136,7 +136,7 @@ OUTPUT
136
136
  nimclient_sequence = sequence('nimclient')
137
137
 
138
138
  @resource.stubs(:should).with(:ensure).returns("1.2.3-4")
139
- Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\-4'").returns(rpm_showres_output).in_sequence(nimclient_sequence)
139
+ Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\-4'").returns(rpm_showres_output).in_sequence(nimclient_sequence)
140
140
  @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo-1.2.3-4").in_sequence(nimclient_sequence)
141
141
  @provider.install
142
142
  end
@@ -163,7 +163,7 @@ mypackage.foo-1.2.3-1 is superseded by mypackage.foo-1.2.3-4
163
163
  OUTPUT
164
164
 
165
165
  @resource.stubs(:should).with(:ensure).returns("1.2.3-1")
166
- Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\-1'").returns(rpm_showres_output).in_sequence(nimclient_sequence)
166
+ Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\-1'").returns(rpm_showres_output).in_sequence(nimclient_sequence)
167
167
  @provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo-1.2.3-1").in_sequence(nimclient_sequence).returns(install_output)
168
168
 
169
169
  expect { @provider.install }.to raise_error(Puppet::Error, "NIM package provider is unable to downgrade packages")
@@ -232,7 +232,8 @@ describe Puppet::Type.type(:user).provider(:windows_adsi), :if => Puppet.feature
232
232
  resource[:name] = 'DOMAIN\testdomainuser'
233
233
  Puppet::Util::Windows::ADSI::Group.expects(:exists?).with(resource[:name]).returns(false)
234
234
  connection.expects(:Create)
235
- connection.expects(:SetPassword)
235
+ connection.expects(:Get).with('UserFlags')
236
+ connection.expects(:Put).with('UserFlags', true)
236
237
  connection.expects(:SetInfo).raises( WIN32OLERuntimeError.new("(in OLE method `SetInfo': )\n OLE error code:8007089A in Active Directory\n The specified username is invalid.\r\n\n HRESULT error code:0x80020009\n Exception occurred."))
237
238
 
238
239
  expect{ provider.create }.to raise_error(
@@ -295,4 +295,35 @@ describe Puppet::Settings::FileSetting do
295
295
  expect(filesetting.munge(':memory:')).to eq(':memory:')
296
296
  end
297
297
  end
298
+
299
+ context "when opening", :unless => Puppet.features.microsoft_windows? do
300
+ let(:path) do
301
+ tmpfile('file_setting_spec')
302
+ end
303
+
304
+ let(:setting) do
305
+ settings = mock("settings", :value => path)
306
+ FileSetting.new(:name => :mysetting, :desc => "creates a file", :settings => settings)
307
+ end
308
+
309
+ it "creates a file with mode 0640" do
310
+ setting.mode = '0640'
311
+
312
+ expect(File).to_not be_exist(path)
313
+ setting.open('w')
314
+
315
+ expect(File).to be_exist(path)
316
+ expect(Puppet::FileSystem.stat(path).mode & 0777).to eq(0640)
317
+ end
318
+
319
+ it "preserves the mode of an existing file" do
320
+ setting.mode = '0640'
321
+
322
+ Puppet::FileSystem.touch(path)
323
+ Puppet::FileSystem.chmod(0644, path)
324
+ setting.open('w')
325
+
326
+ expect(Puppet::FileSystem.stat(path).mode & 0777).to eq(0644)
327
+ end
328
+ end
298
329
  end
@@ -721,6 +721,13 @@ describe Puppet::Transaction, " when determining tags" do
721
721
  expect(@transaction).to be_tagged("one::two")
722
722
  end
723
723
 
724
+ it "should tag one::two only as 'one::two' and not 'one', 'two', and 'one::two'" do
725
+ @transaction.tags = "one::two"
726
+ expect(@transaction).to be_tagged("one::two")
727
+ expect(@transaction).to_not be_tagged("one")
728
+ expect(@transaction).to_not be_tagged("two")
729
+ end
730
+
724
731
  it "should accept a comma-delimited string" do
725
732
  @transaction.tags = "one, two"
726
733
  expect(@transaction).to be_tagged("one")
@@ -183,6 +183,19 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
183
183
  user.password = 'pwd'
184
184
  end
185
185
 
186
+ it "should be able manage a user without a password" do
187
+ adsi_user.expects(:SetPassword).with('pwd').never
188
+ adsi_user.expects(:SetInfo).at_least_once
189
+
190
+ flagname = "UserFlags"
191
+ fADS_UF_DONT_EXPIRE_PASSWD = 0x10000
192
+
193
+ adsi_user.expects(:Get).with(flagname).returns(0)
194
+ adsi_user.expects(:Put).with(flagname, fADS_UF_DONT_EXPIRE_PASSWD)
195
+
196
+ user.password = nil
197
+ end
198
+
186
199
  it "should generate the correct URI" do
187
200
  Puppet::Util::Windows::SID.stubs(:octet_string_to_sid_object).returns(sid)
188
201
  expect(user.uri).to eq("WinNT://testcomputername/#{username},user")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.2
4
+ version: 4.2.3
5
5
  prerelease:
6
6
  platform: x64-mingw32
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-10 00:00:00.000000000 Z
12
+ date: 2015-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: facter