puppet 0.13.0 → 0.13.1

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.

data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.13.1
2
+ Fixed RPM spec files to create puppet user and group (lutter)
3
+ Fixed crontab reading and writing (luke)
4
+ Added symbolic naming in the language (luke)
5
+
1
6
  0.13.0
2
7
  Added support for configuration files.
3
8
  Even more bug fixes, including the infamous 'frozen object' bug, which was a
data/Rakefile CHANGED
@@ -333,6 +333,8 @@ task :update_version => [:prerelease] do
333
333
  rakein.each do |line|
334
334
  if line =~ /^Version:\s*/
335
335
  rakeout.puts "Version: #{PKG_VERSION}"
336
+ elsif line =~ /^Release:\s*/
337
+ rakeout.puts "Release: 1%{?dist}"
336
338
  else
337
339
  rakeout.puts line
338
340
  end
data/bin/puppetd CHANGED
@@ -142,11 +142,9 @@ begin
142
142
  when "--verbose"
143
143
  Puppet::Log.level = :info
144
144
  Puppet::Log.newdestination(:console)
145
- setdest = true
146
145
  when "--debug"
147
146
  Puppet::Log.level = :debug
148
147
  Puppet::Log.newdestination(:console)
149
- setdest = true
150
148
  when "--fqdn"
151
149
  fqdn = arg
152
150
  when "--onetime"
@@ -156,6 +154,7 @@ begin
156
154
  when "--logdest"
157
155
  begin
158
156
  Puppet::Log.newdestination(arg)
157
+ setdest = true
159
158
  rescue => detail
160
159
  $stderr.puts detail.to_s
161
160
  end
@@ -265,4 +264,4 @@ else
265
264
  Puppet.start
266
265
  end
267
266
 
268
- # $Id: puppetd 873 2006-02-07 23:12:33Z luke $
267
+ # $Id: puppetd 895 2006-02-09 21:15:38Z lutter $
data/bin/puppetmasterd CHANGED
@@ -113,7 +113,6 @@ begin
113
113
  when "--debug"
114
114
  Puppet::Log.level = :debug
115
115
  Puppet::Log.newdestination(:console)
116
- setdest = true
117
116
  when "--help"
118
117
  if $haveusage
119
118
  RDoc::usage && exit
@@ -138,7 +137,6 @@ begin
138
137
  puts "%s" % Puppet.version
139
138
  exit
140
139
  when "--verbose"
141
- setdest = true
142
140
  Puppet::Log.level = :info
143
141
  Puppet::Log.newdestination :console
144
142
  else
@@ -236,4 +234,4 @@ rescue => detail
236
234
  exit(1)
237
235
  end
238
236
 
239
- # $Id: puppetmasterd 873 2006-02-07 23:12:33Z luke $
237
+ # $Id: puppetmasterd 895 2006-02-09 21:15:38Z lutter $
@@ -15,7 +15,7 @@ export PATH
15
15
 
16
16
  [ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
17
17
  lockfile=${LOCKFILE-/var/lock/subsys/puppet}
18
- pidfile=${PIDFILE-/var/run/puppet.pid}
18
+ pidfile=${PIDFILE-/var/run/puppet/puppet.pid}
19
19
  puppetd=${PUPPETD-/usr/sbin/puppetd}
20
20
  RETVAL=0
21
21
 
@@ -28,7 +28,7 @@ PUPPET_OPTS=""
28
28
  [ -n "$PUPPET_PORT" ] && PUPPET_OPTS="${PUPPET_OPTS} --port=${PUPPET_PORT}"
29
29
 
30
30
  start() {
31
- echo -n $"Starting puppetd: "
31
+ echo -n $"Starting puppet: "
32
32
  daemon $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS}
33
33
  RETVAL=$?
34
34
  echo
@@ -37,7 +37,7 @@ start() {
37
37
  }
38
38
 
39
39
  stop() {
40
- echo -n $"Stopping puppetd: "
40
+ echo -n $"Stopping puppet: "
41
41
  killproc $puppetd
42
42
  RETVAL=$?
43
43
  echo
@@ -5,7 +5,7 @@
5
5
  #PUPPET_PORT=8140
6
6
 
7
7
  # Where to log to. Specify syslog to send log messages to the system log.
8
- #PUPPET_LOG=syslog
8
+ PUPPET_LOG=/var/log/puppet/puppet.log
9
9
 
10
10
  # You may specify other parameters to the puppet client here
11
11
  #PUPPET_EXTRA_OPTS=--waitforcert=500
@@ -0,0 +1,8 @@
1
+ /var/log/puppet/*log {
2
+ missingok
3
+ create 0644 puppet puppet
4
+ postrotate
5
+ [ -e /etc/init.d/puppetmaster ] && /etc/init.d/puppetmaster condrestart >/dev/null 2>&1 || true
6
+ [ -e /etc/init.d/puppet ] && /etc/init.d/puppet condrestart > /dev/null 2>&1 || true
7
+ endscript
8
+ }
@@ -4,7 +4,7 @@
4
4
 
5
5
  Summary: A network tool for managing many disparate systems
6
6
  Name: puppet
7
- Version: 0.13.0
7
+ Version: 0.13.1
8
8
  Release: 1%{?dist}
9
9
  License: GPL
10
10
  Group: System Environment/Base
@@ -43,6 +43,8 @@ The server can also function as a certificate authority and file server.
43
43
  %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/puppet/manifests
44
44
  %{__install} -d -m0755 %{buildroot}%{_docdir}/%{name}-%{version}
45
45
  %{__install} -d -m0755 %{buildroot}%{_localstatedir}/puppet
46
+ %{__install} -d -m0755 %{buildroot}%{_localstatedir}/run/puppet
47
+ %{__install} -d -m0755 %{buildroot}%{_localstatedir}/log/puppet
46
48
  %{__install} -Dp -m0755 %{_pbuild}/bin/* %{buildroot}%{_sbindir}
47
49
  %{__mv} %{buildroot}%{_sbindir}/puppet %{buildroot}%{_bindir}/puppet
48
50
  %{__install} -Dp -m0644 %{_pbuild}/lib/puppet.rb %{buildroot}%{rubylibdir}/puppet.rb
@@ -52,6 +54,9 @@ The server can also function as a certificate authority and file server.
52
54
  %{__install} -Dp -m0644 %{confdir}/server.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/puppetmaster
53
55
  %{__install} -Dp -m0755 %{confdir}/server.init %{buildroot}%{_initrddir}/puppetmaster
54
56
  %{__install} -Dp -m0644 %{confdir}/fileserver.conf %{buildroot}%{_sysconfdir}/puppet/fileserver.conf
57
+ %{__install} -Dp -m0644 %{confdir}/puppetd.conf %{buildroot}%{_sysconfdir}/puppet/puppetd.conf
58
+ %{__install} -Dp -m0644 %{confdir}/puppetmasterd.conf %{buildroot}%{_sysconfdir}/puppet/puppetmasterd.conf
59
+ %{__install} -Dp -m0644 %{confdir}/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/puppet
55
60
 
56
61
  %files
57
62
  %defattr(-, root, root, 0755)
@@ -61,8 +66,14 @@ The server can also function as a certificate authority and file server.
61
66
  %{_localstatedir}/puppet
62
67
  %{_initrddir}/puppet
63
68
  %config(noreplace) %{_sysconfdir}/sysconfig/puppet
69
+ %config(noreplace) %{_sysconfdir}/puppet/puppetd.conf
64
70
  %doc CHANGELOG COPYING LICENSE README TODO examples
65
71
  %exclude %{_sbindir}/puppetdoc
72
+ %config(noreplace) %{_sysconfdir}/logrotate.d/puppet
73
+ # These need to be owned by puppet so the server can
74
+ # write to them
75
+ %attr(-, puppet, puppet) %{_localstatedir}/run/puppet
76
+ %attr(-, puppet, puppet) %{_localstatedir}/log/puppet
66
77
 
67
78
  %files server
68
79
  %{_sbindir}/puppetmasterd
@@ -70,9 +81,16 @@ The server can also function as a certificate authority and file server.
70
81
  %config(noreplace) %{_sysconfdir}/puppet/*
71
82
  %config(noreplace) %{_sysconfdir}/sysconfig/puppetmaster
72
83
  %config(noreplace) %{_sysconfdir}/puppet/fileserver.conf
84
+ %config(noreplace) %{_sysconfdir}/puppet/puppetmasterd.conf
73
85
  %{_sbindir}/cf2puppet
74
86
  %{_sbindir}/puppetca
75
87
 
88
+ %pre
89
+ # Use uid 317 - we need to find out how to properly assign
90
+ # uid's for system users
91
+ /usr/sbin/useradd -c "Puppet" -u 317 \
92
+ -s /sbin/nologin -r -d /var/puppet puppet 2> /dev/null || :
93
+
76
94
  %post
77
95
  touch %{_localstatedir}/log/puppet.log
78
96
  /sbin/chkconfig --add puppet
@@ -104,7 +122,13 @@ fi
104
122
  %{__rm} -rf %{buildroot}
105
123
 
106
124
  %changelog
107
- * Mon Feb 6 2006 David Lutterkort <dlutter@redhat.com> - 0.12.1-1
125
+ * Wed Feb 8 2006 David Lutterkort <dlutter@redhat.com> - 0.13.0-3
126
+ - Fix puppetd.conf
127
+
128
+ * Wed Feb 8 2006 David Lutterkort <dlutter@redhat.com> - 0.13.0-2
129
+ - Changes to run puppetmaster as user puppet
130
+
131
+ * Mon Feb 6 2006 David Lutterkort <dlutter@redhat.com> - 0.13.0-1
108
132
  - Don't mark initscripts as config files
109
133
 
110
134
  * Mon Feb 6 2006 David Lutterkort <dlutter@redhat.com> - 0.12.0-2
@@ -0,0 +1,5 @@
1
+ [puppetd]
2
+ # Make sure all log messages are sent to the right directory
3
+ # This directory must be writable by the puppet user
4
+ logdir=/var/log/puppet
5
+ rundir=/var/run/puppet
@@ -0,0 +1,5 @@
1
+ [puppetmasterd]
2
+ # Make sure all log messages are sent to the right directory
3
+ # This directory must be writable by the puppet user
4
+ logdir=/var/log/puppet
5
+ rundir=/var/run/puppet
@@ -21,7 +21,7 @@ if [ -f /etc/sysconfig/puppetmaster ]; then
21
21
  fi
22
22
 
23
23
  [ -z "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_MANIFEST=/etc/puppet/manifests/site.pp
24
- [ -z "$PUPPETMASTER_LOG" ] && PUPPETMASTER_LOG="/var/log/puppetmaster.log"
24
+ [ -z "$PUPPETMASTER_LOG" ] && PUPPETMASTER_LOG="/var/log/puppet/puppetmaster.log"
25
25
  PUPPETMASTER_OPTS="
26
26
  --manifest=$PUPPETMASTER_MANIFEST \
27
27
  --logdest=${PUPPETMASTER_LOG} \
@@ -33,7 +33,7 @@ prog=puppetmasterd
33
33
  PUPPETMASTER=/usr/sbin/$prog
34
34
 
35
35
  start() {
36
- echo -n $"Starting $prog: "
36
+ echo -n $"Starting puppetmaster: "
37
37
 
38
38
  # Confirm the manifest exists
39
39
  if [ -r $PUPPETMASTER_MANIFEST ]; then
@@ -52,7 +52,7 @@ start() {
52
52
  }
53
53
 
54
54
  stop() {
55
- echo -n $"Stopping $prog: "
55
+ echo -n $"Stopping puppetmaster: "
56
56
  killproc $PUPPETMASTER
57
57
  RETVAL=$?
58
58
  echo
@@ -0,0 +1,16 @@
1
+ file { "a file":
2
+ path => "/tmp/aliastest",
3
+ ensure => file
4
+ }
5
+
6
+ file { "another":
7
+ path => "/tmp/aliastest2",
8
+ ensure => file,
9
+ require => file["a file"]
10
+ }
11
+
12
+ file { "a third":
13
+ path => "/tmp/aliastest3",
14
+ ensure => file,
15
+ require => file["/tmp/aliastest"]
16
+ }
data/ext/module_puppet CHANGED
@@ -83,9 +83,7 @@ master = {
83
83
  :Local => true
84
84
  }
85
85
 
86
- # We default to a non-console log destination, because we assume this is being
87
- # run non-interactively.
88
- #Puppet[:logdest] = :console
86
+ setdest = false
89
87
 
90
88
  begin
91
89
  result.each { |opt,arg|
@@ -103,12 +101,17 @@ begin
103
101
  when "--use-nodes"
104
102
  master[:UseNodes] = true
105
103
  when "--verbose"
104
+ Puppet::Log.level = :info
105
+ Puppet::Log.newdestination(:console)
106
106
  verbose = true
107
107
  when "--debug"
108
+ Puppet::Log.level = :debug
109
+ Puppet::Log.newdestination(:console)
108
110
  debug = true
109
111
  when "--logdest"
110
112
  begin
111
113
  Puppet::Log.newdestination arg
114
+ setdest=true
112
115
  rescue => detail
113
116
  $stderr.puts detail.to_s
114
117
  end
@@ -124,14 +127,6 @@ rescue GetoptLong::InvalidOption => detail
124
127
  exit(1)
125
128
  end
126
129
 
127
- if debug
128
- Puppet::Log.level = :debug
129
- Puppet::Log.newdestination :console
130
- elsif verbose
131
- Puppet::Log.level = :info
132
- Puppet::Log.newdestination :console
133
- end
134
-
135
130
  # Now parse the config
136
131
  if Puppet[:config] and File.exists? Puppet[:config]
137
132
  Puppet.config.parse(Puppet[:config])
@@ -145,6 +140,10 @@ unless ARGV.length > 0
145
140
  exit(14)
146
141
  end
147
142
 
143
+ unless setdest
144
+ Puppet::Log.newdestination(:syslog)
145
+ end
146
+
148
147
  master[:File] = ARGV.shift
149
148
 
150
149
  unless ENV.include?("CFALLCLASSES")
data/lib/puppet.rb CHANGED
@@ -14,7 +14,7 @@ require 'puppet/util'
14
14
  #
15
15
  # it's also a place to find top-level commands like 'debug'
16
16
  module Puppet
17
- PUPPETVERSION = '0.13.0'
17
+ PUPPETVERSION = '0.13.1'
18
18
 
19
19
  def Puppet.version
20
20
  return PUPPETVERSION
@@ -122,10 +122,11 @@ module Puppet
122
122
  directory can be removed without causing harm (although it might
123
123
  result in spurious service restarts)."],
124
124
  [:rundir, "$vardir/run", "Where Puppet PID files are kept."],
125
+ [:lockdir, "$vardir/locks", "Where lock files are kept."],
125
126
  [:statefile, "$statedir/state.yaml",
126
- "Where puppetd and puppetmasterd store state associated with the running
127
- configuration. In the case of puppetmasterd, this file reflects the
128
- state discovered through interacting with clients."],
127
+ "Where puppetd and puppetmasterd store state associated with the
128
+ running configuration. In the case of puppetmasterd, this file
129
+ reflects the state discovered through interacting with clients."],
129
130
  [:ssldir, "$confdir/ssl", "Where SSL certificates are kept."],
130
131
  [:genconfig, false,
131
132
  "Whether to just print a configuration to stdout and exit. Only makes
data/lib/puppet/client.rb CHANGED
@@ -11,9 +11,9 @@ module Puppet
11
11
  include Puppet
12
12
  include SignalObserver
13
13
 
14
- # FIXME the cert stuff should only come up with networking, so it
15
- # should be in the network client, not the normal client
16
- # but if i do that, it's hard to tell whether the certs have been initialized
14
+ # FIXME The cert stuff should only come up with networking, so it
15
+ # should be in the network client, not the normal client. But if i do
16
+ # that, it's hard to tell whether the certs have been initialized.
17
17
  include Puppet::Daemon
18
18
  attr_reader :local, :secureinit
19
19
  attr_accessor :schedule, :lastrun
@@ -151,4 +151,4 @@ module Puppet
151
151
  end
152
152
  end
153
153
 
154
- # $Id: client.rb 849 2006-01-24 06:37:00Z luke $
154
+ # $Id: client.rb 897 2006-02-12 18:08:39Z luke $
data/lib/puppet/daemon.rb CHANGED
@@ -221,7 +221,8 @@ module Puppet
221
221
  begin
222
222
  File.unlink(@pidfile)
223
223
  rescue => detail
224
- Puppet.err "Could not remove PID file %s: %s" % [@pidfile, detail]
224
+ Puppet.err "Could not remove PID file %s: %s" %
225
+ [@pidfile, detail]
225
226
  end
226
227
  end
227
228
 
@@ -233,4 +234,4 @@ module Puppet
233
234
  end
234
235
  end
235
236
 
236
- # $Id: daemon.rb 856 2006-01-30 16:18:24Z luke $
237
+ # $Id: daemon.rb 897 2006-02-12 18:08:39Z luke $
@@ -44,6 +44,9 @@ module Puppet
44
44
  rescue Puppet::Error => detail
45
45
  raise
46
46
  rescue => detail
47
+ if Puppet[:debug]
48
+ puts detail.backtrace
49
+ end
47
50
  raise Puppet::Error, "%s could not read %s: %s" %
48
51
  [self.class, @path, detail]
49
52
  end
@@ -134,29 +137,38 @@ module Puppet
134
137
  # Only add the -u flag when the @path is different. Fedora apparently
135
138
  # does not think I should be allowed to set the @path to my
136
139
  def cmdbase
137
- uid = CronType.uid(@path)
138
140
  cmd = nil
139
- if uid == Process.uid
141
+ if @path == Process.uid
140
142
  return "crontab"
141
143
  else
142
144
  return "crontab -u #{@path}"
143
145
  end
144
146
  end
145
147
 
148
+ def initialize(user)
149
+ begin
150
+ uid = Puppet::Util.uid(user)
151
+ rescue Puppet::Error => detail
152
+ raise Puppet::Error, "Could not retrieve user %s" % user
153
+ end
154
+
155
+ @path = uid
156
+ end
157
+
146
158
  # Read a specific @path's cron tab.
147
159
  def read
148
- %x{#{cmdbase(@path)} -l 2>/dev/null}
160
+ %x{#{cmdbase()} -l 2>/dev/null}
149
161
  end
150
162
 
151
163
  # Remove a specific @path's cron tab.
152
164
  def remove
153
- %x{#{cmdbase(@path)} -r 2>/dev/null}
165
+ %x{#{cmdbase()} -r 2>/dev/null}
154
166
  end
155
167
 
156
168
  # Overwrite a specific @path's cron tab; must be passed the @path name
157
169
  # and the text with which to create the cron tab.
158
170
  def write(text)
159
- IO.popen("#{cmdbase(@path)} -", "w") { |p|
171
+ IO.popen("#{cmdbase()} -", "w") { |p|
160
172
  p.print text
161
173
  }
162
174
  end
@@ -192,4 +204,4 @@ module Puppet
192
204
  end
193
205
  end
194
206
 
195
- # $Id: filetype.rb 848 2006-01-24 06:01:58Z luke $
207
+ # $Id: filetype.rb 898 2006-02-13 17:13:09Z luke $
@@ -0,0 +1,64 @@
1
+ require 'thread'
2
+ require 'sync'
3
+
4
+ # Gotten from:
5
+ # http://path.berkeley.edu/~vjoel/ruby/solaris-bug.rb
6
+
7
+ # Extensions to the File class for exception-safe file locking in a
8
+ # environment with multiple user threads.
9
+
10
+ # This is here because closing a file on solaris unlocks any locks that
11
+ # other threads might have. So we have to make sure that only the last
12
+ # reader thread closes the file.
13
+ #
14
+ # The hash maps inode number to a count of reader threads
15
+ $reader_count = Hash.new(0)
16
+
17
+ class File
18
+ # Get an exclusive (i.e., write) lock on the file, and yield to the block.
19
+ # If the lock is not available, wait for it without blocking other ruby
20
+ # threads.
21
+ def lock_exclusive
22
+ if Thread.list.size == 1
23
+ flock(LOCK_EX)
24
+ else
25
+ # ugly hack because waiting for a lock in a Ruby thread blocks the
26
+ # process
27
+ period = 0.001
28
+ until flock(LOCK_EX|LOCK_NB)
29
+ sleep period
30
+ period *= 2 if period < 1
31
+ end
32
+ end
33
+
34
+ yield self
35
+ ensure
36
+ flush
37
+ flock(LOCK_UN)
38
+ end
39
+
40
+ # Get a shared (i.e., read) lock on the file, and yield to the block.
41
+ # If the lock is not available, wait for it without blocking other ruby
42
+ # threads.
43
+ def lock_shared
44
+ if Thread.list.size == 1
45
+ flock(LOCK_SH)
46
+ else
47
+ # ugly hack because waiting for a lock in a Ruby thread blocks the
48
+ # process
49
+ period = 0.001
50
+ until flock(LOCK_SH|LOCK_NB)
51
+ sleep period
52
+ period *= 2 if period < 1
53
+ end
54
+ end
55
+
56
+ yield self
57
+ ensure
58
+ Thread.exclusive {flock(LOCK_UN) if $reader_count[self.stat.ino] == 1}
59
+ ## for solaris, no need to unlock here--closing does it
60
+ ## but this has no effect on the bug
61
+ end
62
+ end
63
+
64
+ # $Id: lock.rb 897 2006-02-12 18:08:39Z luke $