[chef] Test kitchen + ntp cookbook + docker?


Chronological Thread 
  • From: Morgan Blackthorne < >
  • To: " " < >
  • Subject: [chef] Test kitchen + ntp cookbook + docker?
  • Date: Thu, 16 Apr 2015 14:59:46 -0700

So after upgrading to chefdk 0.5.0rc5, I've been able to get past the issues I had and now I can run kitchen converge on the ntp cookbook and it connects to docker and seems to work great.

Except that it never actually completes, it's hanging on this output:

       -# Local users may interrogate the ntp server more closely.
       -restrict 127.0.0.1
       -restrict ::1
        
       -# Clients from this (example!) subnet have unlimited access, but only if
       -# cryptographically authenticated.
           -#restrict 192.168.123.0 mask 255.255.255.0 notrust
           -
       -
           -# If you want to provide time to your local subnet, change the next line.
       -# (Again, the address is an example only.)
           -#broadcast 192.168.123.255
       -
           -# If you want to listen to time broadcasts on your local subnet, de-comment the
       -# next lines.  Please do this only if you trust everybody on the network!
       -#disable auth
       -#broadcastclient
         * execute[Stop ntp in preparation for ntpdate] action run
       - execute /bin/true
         * service[ntp] action stop (up to date)

Checking docker ps doesn't show much helpful:

ashdcsbamboo00:~$ docker -H tcp://localhost:5000 ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                   NAMES
ffc2cb76a630        24b877679eab        "/usr/sbin/sshd -D -   9 days ago          Up 9 days           0.0.0.0:49153->22/tcp   reverent_feynman    
ashdcsbamboo00:~$ 

Nor does a ps inside the container:

:/tmp/kitchen# ps aw
  PID TTY      STAT   TIME COMMAND
   91 pts/0    Ss+    0:00 sh -c  sudo -E /opt/chef/bin/chef-solo --config /tmp/kitchen/solo.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/ki
   92 pts/0    S+     0:00 sudo -E /opt/chef/bin/chef-solo --config /tmp/kitchen/solo.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/d
   93 pts/0    Sl+    0:01 /opt/chef/embedded/bin/ruby /opt/chef/bin/chef-solo --config /tmp/kitchen/solo.rb --log_level auto --force-formatter --no-color --json-attri
   98 pts/0    Sl+    0:06 chef-solo worker: ppid=93;start=21:42:05;
  427 pts/0    S      0:00 ntpd -q
  430 ?        S      0:00 bash
  460 ?        R+     0:00 ps aw
:/tmp/kitchen# 

After manually killing the ntpd proccess (service ntpd stop did not work for some reason), as the last thing chef-solo showed was an attempt to stop the ntpd service, I got a bit further:

         * execute[Force sync system clock with ntp server] action run
       - execute ntpd -q
         * execute[Force sync hardware clock with system clock] action run
           
           ================================================================================
           Error executing action `run` on resource 'execute[Force sync hardware clock with system clock]'
       ================================================================================
           
           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '70'
           ---- Begin output of hwclock --systohc ----
       STDOUT: 
       STDERR: hwclock: Cannot access the Hardware Clock via any known method.
           hwclock: Use the --debug option to see the details of our search for an access method.
       ---- End output of hwclock --systohc ----
           Ran hwclock --systohc returned 70

Is this a known issue with docker containers and the hardware clock? Running the command directly with --debug shows:

:/tmp/kitchen# hwclock --systohc --debug 
hwclock from util-linux 2.20.1
hwclock: Open of /dev/rtc failed: No such file or directory
No usable clock interface found.
hwclock: Cannot access the Hardware Clock via any known method.
:/tmp/kitchen# 

I'm basically using the ntp cookbook tests to verify that I have my TK + docker setup correct, so that I can then move on to writing my own tests, so if this is just a specific issue with this cookbook, then I can move on. Just not sure if there are any other gotchas I need to look out for.

--
~*~ StormeRider ~*~

"Every world needs its heroes [...] They inspire us to be better than we are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS


  • [chef] Test kitchen + ntp cookbook + docker?, Morgan Blackthorne, 04/16/2015

Archive powered by MHonArc 2.6.16.

§