chef 0.7.10 → 0.7.12

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

Potentially problematic release.


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

Files changed (70) hide show
  1. data/distro/debian/etc/init.d/chef-client +175 -0
  2. data/distro/debian/etc/init.d/chef-indexer +175 -0
  3. data/distro/debian/etc/init.d/chef-server +120 -0
  4. data/distro/debian/man/man1/chef-indexer.1 +42 -0
  5. data/distro/debian/man/man1/chef-server.1 +108 -0
  6. data/distro/debian/man/man8/chef-client.8 +61 -0
  7. data/distro/debian/man/man8/chef-solo.8 +58 -0
  8. data/distro/redhat/etc/chef/client.rb +16 -0
  9. data/distro/redhat/etc/chef/indexer.rb +10 -0
  10. data/distro/redhat/etc/chef/server.rb +22 -0
  11. data/distro/redhat/etc/init.d/chef-client +74 -0
  12. data/distro/redhat/etc/init.d/chef-indexer +76 -0
  13. data/distro/redhat/etc/init.d/chef-server +77 -0
  14. data/lib/chef.rb +1 -1
  15. data/lib/chef/client.rb +33 -8
  16. data/lib/chef/compile.rb +34 -2
  17. data/lib/chef/cookbook.rb +29 -2
  18. data/lib/chef/cookbook_loader.rb +61 -49
  19. data/lib/chef/couchdb.rb +7 -3
  20. data/lib/chef/mixin/command.rb +67 -32
  21. data/lib/chef/mixin/convert_to_class_name.rb +48 -0
  22. data/lib/chef/mixin/find_preferred_file.rb +5 -14
  23. data/lib/chef/mixin/from_file.rb +14 -0
  24. data/lib/chef/mixin/generate_url.rb +2 -1
  25. data/lib/chef/mixin/recipe_definition_dsl_core.rb +77 -0
  26. data/lib/chef/platform.rb +1 -1
  27. data/lib/chef/provider.rb +63 -2
  28. data/lib/chef/provider/cron.rb +75 -25
  29. data/lib/chef/provider/deploy.rb +281 -0
  30. data/lib/chef/provider/deploy/revision.rb +70 -0
  31. data/lib/chef/provider/deploy/timestamped.rb +33 -0
  32. data/lib/chef/provider/git.rb +194 -0
  33. data/lib/chef/provider/group.rb +2 -2
  34. data/lib/chef/provider/group/gpasswd.rb +50 -0
  35. data/lib/chef/provider/group/groupadd.rb +2 -16
  36. data/lib/chef/provider/group/usermod.rb +57 -0
  37. data/lib/chef/provider/ifconfig.rb +3 -3
  38. data/lib/chef/provider/mount.rb +0 -4
  39. data/lib/chef/provider/mount/mount.rb +2 -2
  40. data/lib/chef/provider/package.rb +2 -2
  41. data/lib/chef/provider/package/apt.rb +4 -4
  42. data/lib/chef/provider/package/dpkg.rb +9 -13
  43. data/lib/chef/provider/package/freebsd.rb +6 -6
  44. data/lib/chef/provider/package/macports.rb +4 -4
  45. data/lib/chef/provider/package/portage.rb +3 -3
  46. data/lib/chef/provider/package/rpm.rb +4 -4
  47. data/lib/chef/provider/package/rubygems.rb +10 -4
  48. data/lib/chef/provider/package/yum.rb +6 -6
  49. data/lib/chef/provider/remote_file.rb +14 -7
  50. data/lib/chef/provider/service.rb +8 -2
  51. data/lib/chef/provider/service/freebsd.rb +1 -1
  52. data/lib/chef/provider/service/init.rb +8 -63
  53. data/lib/chef/provider/service/redhat.rb +2 -2
  54. data/lib/chef/provider/service/simple.rb +115 -0
  55. data/lib/chef/provider/subversion.rb +145 -0
  56. data/lib/chef/provider/template.rb +2 -0
  57. data/lib/chef/provider/user.rb +2 -2
  58. data/lib/chef/recipe.rb +9 -75
  59. data/lib/chef/resource.rb +131 -7
  60. data/lib/chef/resource/cron.rb +36 -0
  61. data/lib/chef/resource/deploy.rb +360 -0
  62. data/lib/chef/resource/deploy_revision.rb +35 -0
  63. data/lib/chef/resource/git.rb +36 -0
  64. data/lib/chef/resource/group.rb +2 -0
  65. data/lib/chef/resource/scm.rb +129 -0
  66. data/lib/chef/resource/subversion.rb +33 -0
  67. data/lib/chef/resource/timestamped_deploy.rb +31 -0
  68. data/lib/chef/resource_collection.rb +32 -4
  69. data/lib/chef/runner.rb +35 -28
  70. metadata +40 -11
@@ -0,0 +1,175 @@
1
+ #! /bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: chef-client
4
+ # Required-Start: $network
5
+ # Required-Stop: $network
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Start a chef-client.
9
+ ### END INIT INFO
10
+ #
11
+ # Copyright (c) 2009 Joshua Timberman, <joshua@opscode.com>
12
+ #
13
+ # chef-client Startup script for chef-client.
14
+ # chkconfig: - 98 02
15
+ # description: starts up chef-client in daemon mode.
16
+
17
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
+ DAEMON=/usr/bin/chef-client
19
+ NAME=chef-client
20
+ DESC=chef-client
21
+ LOGDIR=/var/log/chef
22
+ CONFIG=/etc/chef/client.rb
23
+ PIDFILE=/var/run/chef/client.pid
24
+
25
+ test -x $DAEMON || exit 0
26
+
27
+ . /lib/lsb/init-functions
28
+
29
+ if [ ! -d /var/run/chef ]; then
30
+ mkdir /var/run/chef
31
+ fi
32
+
33
+ DAEMON_OPTS="-d -c $CONFIG -i 1800 -s 20"
34
+
35
+ running_pid() {
36
+ pid=$1
37
+ name=$2
38
+ [ -z "$pid" ] && return 1
39
+ [ ! -d /proc/$pid ] && return 1
40
+ cmd=`awk '/Name:/ {print $2}' /proc/$pid/status`
41
+ [ "$cmd" != "$name" ] && return 1
42
+ return 0
43
+ }
44
+
45
+ running() {
46
+ [ ! -f "$PIDFILE" ] && return 1
47
+ pid=`cat $PIDFILE`
48
+ running_pid $pid $NAME || return 1
49
+ return 0
50
+ }
51
+
52
+ start_server() {
53
+ if [ -z "$DAEMONUSER" ] ; then
54
+ start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
55
+ errcode=$?
56
+ else
57
+ start-stop-daemon --start --quiet --pidfile $PIDFILE \
58
+ --chuid $DAEMONUSER \
59
+ --exec $DAEMON -- $DAEMON_OPTS
60
+ errcode=$?
61
+ fi
62
+ return $errcode
63
+ }
64
+
65
+ stop_server() {
66
+ if [ -z "$DAEMONUSER" ] ; then
67
+ killproc -p $PIDFILE $DAEMON
68
+ errcode=$?
69
+ else
70
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
71
+ --user $DAEMONUSER \
72
+ --exec $DAEMON
73
+ errcode=$?
74
+ fi
75
+ return $errcode
76
+ }
77
+
78
+ reload_server() {
79
+ [ ! -f "$PIDFILE" ] && return 1
80
+ pid=pidofproc $PIDFILE # This is the daemon's pid
81
+ /bin/kill -1 $pid
82
+ return $?
83
+ }
84
+
85
+ force_stop() {
86
+ [ ! -e "$PIDFILE" ] && return
87
+ if running ; then
88
+ /bin/kill -15 $pid
89
+ sleep "$DIETIME"s
90
+ if running ; then
91
+ /bin/kill -9 $pid
92
+ sleep "$DIETIME"s
93
+ if running ; then
94
+ echo "Cannot kill $NAME (pid=$pid)!"
95
+ exit 1
96
+ fi
97
+ fi
98
+ fi
99
+ rm -f $PIDFILE
100
+ }
101
+
102
+ case "$1" in
103
+ start)
104
+ log_daemon_msg "Starting $DESC " "$NAME"
105
+ if running ; then
106
+ log_progress_msg "apparently already running"
107
+ log_end_msg 0
108
+ exit 0
109
+ fi
110
+ if start_server ; then
111
+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
112
+ if running ; then
113
+ log_end_msg 0
114
+ else
115
+ log_end_msg 1
116
+ fi
117
+ else
118
+ log_end_msg 1
119
+ fi
120
+ ;;
121
+ stop)
122
+ log_daemon_msg "Stopping $DESC" "$NAME"
123
+ if running ; then
124
+ errcode=0
125
+ stop_server || errcode=$?
126
+ log_end_msg $errcode
127
+ else
128
+ log_progress_msg "apparently not running"
129
+ log_end_msg 0
130
+ exit 0
131
+ fi
132
+ ;;
133
+ force-stop)
134
+ $0 stop
135
+ if running; then
136
+ log_daemon_msg "Stopping (force) $DESC" "$NAME"
137
+ errcode=0
138
+ force_stop || errcode=$?
139
+ log_end_msg $errcode
140
+ fi
141
+ ;;
142
+ restart|force-reload)
143
+ log_daemon_msg "Restarting $DESC" "$NAME"
144
+ errcode=0
145
+ stop_server || errcode=$?
146
+ [ -n "$DIETIME" ] && sleep $DIETIME
147
+ start_server || errcode=$?
148
+ [ -n "$STARTTIME" ] && sleep $STARTTIME
149
+ running || errcode=$?
150
+ log_end_msg $errcode
151
+ ;;
152
+ status)
153
+ log_daemon_msg "Checking status of $DESC" "$NAME"
154
+ if running ; then
155
+ log_progress_msg "running"
156
+ log_end_msg 0
157
+ else
158
+ log_progress_msg "apparently not running"
159
+ log_end_msg 1
160
+ exit 3
161
+ fi
162
+ ;;
163
+ reload)
164
+ log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
165
+ log_warning_msg "cannot re-read the config file (use restart)."
166
+ ;;
167
+ *)
168
+ N=/etc/init.d/$NAME
169
+ echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
170
+ exit 1
171
+ ;;
172
+ esac
173
+
174
+ exit 0
175
+
@@ -0,0 +1,175 @@
1
+ #! /bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: chef-indexer
4
+ # Required-Start: $network
5
+ # Required-Stop: $network
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Start a chef-indexer.
9
+ ### END INIT INFO
10
+ #
11
+ # Copyright (c) 2009 Joshua Timberman, <joshua@opscode.com>
12
+ #
13
+ # chef-indexer Startup script for chef-indexer.
14
+ # chkconfig: - 98 02
15
+ # description: starts up chef-indexer in daemon mode.
16
+
17
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
+ DAEMON=/usr/bin/chef-indexer
19
+ NAME=chef-indexer
20
+ DESC=chef-indexer
21
+ LOGDIR=/var/log/chef
22
+ CONFIG=/etc/chef/indexer.rb
23
+ PIDFILE=/var/run/chef/indexer.pid
24
+
25
+ test -x $DAEMON || exit 0
26
+
27
+ . /lib/lsb/init-functions
28
+
29
+ if [ ! -d /var/run/chef ]; then
30
+ mkdir /var/run/chef
31
+ fi
32
+
33
+ DAEMON_OPTS="-d -c $CONFIG"
34
+
35
+ running_pid() {
36
+ pid=$1
37
+ name=$2
38
+ [ -z "$pid" ] && return 1
39
+ [ ! -d /proc/$pid ] && return 1
40
+ cmd=`cat /proc/$pid/cmdline | tr '\000' '\n' | awk 'NR==2'`
41
+ [ "$cmd" != "$name" ] && return 1
42
+ return 0
43
+ }
44
+
45
+ running() {
46
+ [ ! -f "$PIDFILE" ] && return 1
47
+ pid=`cat $PIDFILE`
48
+ running_pid $pid $DAEMON || return 1
49
+ return 0
50
+ }
51
+
52
+ start_server() {
53
+ if [ -z "$DAEMONUSER" ] ; then
54
+ start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
55
+ errcode=$?
56
+ else
57
+ start-stop-daemon --start --quiet --pidfile $PIDFILE \
58
+ --chuid $DAEMONUSER \
59
+ --exec $DAEMON -- $DAEMON_OPTS
60
+ errcode=$?
61
+ fi
62
+ return $errcode
63
+ }
64
+
65
+ stop_server() {
66
+ if [ -z "$DAEMONUSER" ] ; then
67
+ killproc -p $PIDFILE $DAEMON
68
+ errcode=$?
69
+ else
70
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
71
+ --user $DAEMONUSER \
72
+ --exec $DAEMON
73
+ errcode=$?
74
+ fi
75
+ return $errcode
76
+ }
77
+
78
+ reload_server() {
79
+ [ ! -f "$PIDFILE" ] && return 1
80
+ pid=pidofproc $PIDFILE # This is the daemon's pid
81
+ /bin/kill -1 $pid
82
+ return $?
83
+ }
84
+
85
+ force_stop() {
86
+ [ ! -e "$PIDFILE" ] && return
87
+ if running ; then
88
+ /bin/kill -15 $pid
89
+ sleep "$DIETIME"s
90
+ if running ; then
91
+ /bin/kill -9 $pid
92
+ sleep "$DIETIME"s
93
+ if running ; then
94
+ echo "Cannot kill $NAME (pid=$pid)!"
95
+ exit 1
96
+ fi
97
+ fi
98
+ fi
99
+ rm -f $PIDFILE
100
+ }
101
+
102
+ case "$1" in
103
+ start)
104
+ log_daemon_msg "Starting $DESC " "$NAME"
105
+ if running ; then
106
+ log_progress_msg "apparently already running"
107
+ log_end_msg 0
108
+ exit 3
109
+ fi
110
+ if start_server ; then
111
+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
112
+ if running ; then
113
+ log_end_msg 0
114
+ else
115
+ log_end_msg 1
116
+ fi
117
+ else
118
+ log_end_msg 1
119
+ fi
120
+ ;;
121
+ stop)
122
+ log_daemon_msg "Stopping $DESC" "$NAME"
123
+ if running ; then
124
+ errcode=0
125
+ stop_server || errcode=$?
126
+ log_end_msg $errcode
127
+ else
128
+ log_progress_msg "apparently not running"
129
+ log_end_msg 0
130
+ exit 0
131
+ fi
132
+ ;;
133
+ force-stop)
134
+ $0 stop
135
+ if running; then
136
+ log_daemon_msg "Stopping (force) $DESC" "$NAME"
137
+ errcode=0
138
+ force_stop || errcode=$?
139
+ log_end_msg $errcode
140
+ fi
141
+ ;;
142
+ restart|force-reload)
143
+ log_daemon_msg "Restarting $DESC" "$NAME"
144
+ errcode=0
145
+ stop_server || errcode=$?
146
+ [ -n "$DIETIME" ] && sleep $DIETIME
147
+ start_server || errcode=$?
148
+ [ -n "$STARTTIME" ] && sleep $STARTTIME
149
+ running || errcode=$?
150
+ log_end_msg $errcode
151
+ ;;
152
+ status)
153
+ log_daemon_msg "Checking status of $DESC" "$NAME"
154
+ if running ; then
155
+ log_progress_msg "running"
156
+ log_end_msg 0
157
+ else
158
+ log_progress_msg "apparently not running"
159
+ log_end_msg 1
160
+ exit 1
161
+ fi
162
+ ;;
163
+ reload)
164
+ log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
165
+ log_warning_msg "cannot re-read the config file (use restart)."
166
+ ;;
167
+ *)
168
+ N=/etc/init.d/$NAME
169
+ echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
170
+ exit 1
171
+ ;;
172
+ esac
173
+
174
+ exit 0
175
+
@@ -0,0 +1,120 @@
1
+ #! /bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: chef-server
4
+ # Required-Start: $network
5
+ # Required-Stop: $network
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Start a chef-server.
9
+ ### END INIT INFO
10
+ #
11
+ # Copyright (c) 2009 Joshua Timberman, <joshua@opscode.com>
12
+ #
13
+ # chef-server Startup script for chef-server.
14
+ # chkconfig: - 98 02
15
+ # description: starts up chef-server webui.
16
+
17
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
+ DAEMON=/usr/bin/chef-server
19
+ PIDFILE=/var/run/chef/server.%s.pid
20
+ MAINPID=/var/run/chef/server.main.pid
21
+ LOGFILE=/var/log/chef/merb.%s.log
22
+ MASTER=master
23
+ NAME=chef-server
24
+ DESC=chef-server
25
+ DAEMON_OPTS="-d -c2 -P $PIDFILE -L $LOGFILE"
26
+
27
+ test -x $DAEMON || exit 0
28
+
29
+ . /lib/lsb/init-functions
30
+
31
+ if [ ! -d /var/run/chef ]; then
32
+ mkdir /var/run/chef
33
+ fi
34
+
35
+ running() {
36
+ [ ! -f "$MAINPID" ] && return 1
37
+ pid=`cat $MAINPID`
38
+ name=$MASTER
39
+ [ -z "$pid" ] && return 1
40
+ [ ! -d /proc/$pid ] && return 1
41
+ cmd=`cat /proc/$pid/cmdline | tr '\000' '\n' | head -1 | awk -F:\ '{print $3}'`
42
+ [ "$cmd" != "$name" ] && return 1
43
+ return 0
44
+ }
45
+
46
+ start_server() {
47
+ $DAEMON $DAEMON_OPTS
48
+ errcode=$?
49
+ return $errcode
50
+ }
51
+
52
+ stop_server() {
53
+ $DAEMON -K all -P $PIDFILE
54
+ errcode=$?
55
+ return $errcode
56
+ }
57
+
58
+ reload_server() {
59
+ stop_server
60
+ start_server
61
+ }
62
+
63
+ case "$1" in
64
+ start)
65
+ log_daemon_msg "Starting $DESC "
66
+ if running ; then
67
+ log_progress_msg "apparently already running"
68
+ log_end_msg 0
69
+ exit 0
70
+ fi
71
+ if start_server ; then
72
+ sleep 1
73
+ if running ; then
74
+ log_end_msg 0
75
+ else
76
+ log_end_msg 1
77
+ fi
78
+ else
79
+ log_end_msg 1
80
+ fi
81
+ ;;
82
+ stop)
83
+ log_daemon_msg "Stopping $DESC"
84
+ if running ; then
85
+ errcode=0
86
+ stop_server || errcode=$?
87
+ log_end_msg $errcode
88
+ else
89
+ log_progress_msg "apparently not running"
90
+ log_end_msg 0
91
+ exit 0
92
+ fi
93
+ ;;
94
+ restart|force-reload)
95
+ log_daemon_msg "Restarting $DESC"
96
+ errcode=0
97
+ reload_server
98
+ running && errcode=$?
99
+ log_end_msg $errcode
100
+ ;;
101
+ status)
102
+ log_daemon_msg "Checking status of $DESC"
103
+ if running ; then
104
+ log_progress_msg "running"
105
+ log_end_msg 0
106
+ else
107
+ log_progress_msg "apparently not running"
108
+ log_end_msg 1
109
+ exit 3
110
+ fi
111
+ ;;
112
+ *)
113
+ N=/etc/init.d/$NAME
114
+ echo "Usage: $N {start|stop|restart|status}" >&2
115
+ exit 1
116
+ ;;
117
+ esac
118
+
119
+ exit 0
120
+