Skip to content

Instantly share code, notes, and snippets.

@inokappa
Created May 4, 2014 21:49
Show Gist options
  • Save inokappa/4af007ad6eb9a901bcc4 to your computer and use it in GitHub Desktop.
Save inokappa/4af007ad6eb9a901bcc4 to your computer and use it in GitHub Desktop.
Chef から Docker コンテナを操作した時のログ
Recipe: docker-test::default
* docker_image[centos] action pull[2014-05-04T21:41:21+00:00] INFO: Processing docker_image[centos] action pull (docker-test::default line 3)
* docker_container[centos] action run[2014-05-04T21:42:26+00:00] INFO: Processing docker_container[centos] action run (docker-test::default line 5)
Recipe: <Dynamically Defined Resource>
* template[/etc/init.d/centos] action create[2014-05-04T21:42:27+00:00] INFO: Processing template[/etc/init.d/centos] action create (/root/chef-repo-test/cookbooks/docker/providers/container.rb line 402)
[2014-05-04T21:42:28+00:00] INFO: template[/etc/init.d/centos] created file /etc/init.d/centos
- create new file /etc/init.d/centos[2014-05-04T21:42:28+00:00] INFO: template[/etc/init.d/centos] updated file contents /etc/init.d/centos
- update content in file /etc/init.d/centos from none to 63ff4d
--- /etc/init.d/centos 2014-05-04 21:42:28.015384586 +0000
+++ /tmp/chef-rendered-template20140504-3756-adspbw 2014-05-04 21:42:28.020384586 +0000
@@ -1 +1,109 @@
+#!/bin/sh
+#
+# /etc/rc.d/init.d/centos
+#
+# centos
+#
+# chkconfig: 2345 96 94
+# description: centos
+
+### BEGIN INIT INFO
+# Provides: centos
+# Required-Start: $network
+# Required-Stop:
+# Should-Start:
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop centos
+# Description: centos
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/docker"
+prog="centos"
+pidfile="/var/run/$prog.pid"
+lockfile="/var/lock/subsys/$prog"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+start() {
+ [ -x $exec ] || exit 5
+
+ if ! [ -f $pidfile ]; then
+ printf "Starting $prog:\t"
+ $exec start $prog > /dev/null 2>&1
+ pid=$!
+ touch $lockfile
+ success
+ echo
+ else
+ failure
+ echo
+ printf "$pidfile still exists...\n"
+ exit 7
+ fi
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+ $exec stop -t 60 $prog
+ retval=$?
+ rm -f $pidfile
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+force_reload() {
+ restart
+}
+
+status() {
+ $exec ps -a -notrunc | grep $prog | grep -qc "Up"
+}
+
+case "$1" in
+ start)
+ status && exit 0
+ $1
+ ;;
+ stop)
+ status || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ status || exit 7
+ $1
+ ;;
+ force-reload)
+ force_reload
+ ;;
+ status)
+ $1
+ ;;
+ condrestart|try-restart)
+ status || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+ exit 2
+esac
+
+exit $?[2014-05-04T21:42:28+00:00] INFO: template[/etc/init.d/centos] owner changed to 0
[2014-05-04T21:42:28+00:00] INFO: template[/etc/init.d/centos] group changed to 0
[2014-05-04T21:42:28+00:00] INFO: template[/etc/init.d/centos] mode changed to 755
- change mode from '' to '0755'
- change owner from '' to 'root'
- change group from '' to 'root'
- restore selinux security context
* service[centos] action start[2014-05-04T21:42:29+00:00] INFO: Processing service[centos] action start (/root/chef-repo-test/cookbooks/docker/providers/container.rb line 331)
[2014-05-04T21:42:30+00:00] INFO: service[centos] started
- start service service[centos]
* service[centos] action enable[2014-05-04T21:42:30+00:00] INFO: Processing service[centos] action enable (/root/chef-repo-test/cookbooks/docker/providers/container.rb line 331)
[2014-05-04T21:42:31+00:00] INFO: service[centos] enabled
- enable service service[centos]
[2014-05-04T21:42:31+00:00] INFO: Chef Run complete in 83.146212147 seconds
Running handlers:
[2014-05-04T21:42:31+00:00] INFO: Running report handlers
Running handlers complete
[2014-05-04T21:42:31+00:00] INFO: Report handlers complete
Chef Client finished, 5/12 resources updated in 87.887099488 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment