Comment 2 for bug 1597699

Revision history for this message
Scott Moser (smoser) wrote :

I've verified this in an lxc container using the method described here.

# launch instance (lxc)
$ name="mcollective0"
$ cat > user-data <<EOF
#cloud-config
mcollective:
  conf:
    main_collective: mcollective
    collectives: mcollective
    libdir: /usr/share/mcollective/plugins
    logfile: /var/log/mcollective.log
    loglevel: debug
    daemonize: 1
    direct_addressing: 1
    ttl: 4294957
    securityprovider: psk
    plugin.psk: unset
    identity: 2

    connector: rabbitmq
    plugin.rabbitmq.vhost: mcollective
    plugin.rabbitmq.pool.size: 1
    plugin.rabbitmq.pool.1.host: 10.10.0.2
    plugin.rabbitmq.pool.1.port: 61613
    plugin.rabbitmq.pool.1.user: mcollective
    plugin.rabbitmq.pool.1.password: ScwpVo8egrZ0OmT6sRmp9zEA
    plugin.rabbitmq.heartbeat_interval: 30

    factsource: yaml
    plugin.yaml: /etc/mcollective/facts.yaml
EOF
$ lxc launch ubuntu-daily:xenial $name "--config=user.user-data=$(cat user-data)"

# wait for boot
$ while ! lxc exec $name -- test -e /run/cloud-init/result.json; do echo .; sleep 1; done

# get in the instance (first boot, unpatched)
$ lxc exec "$name" /bin/bash
# PS1="% "
% cat /etc/cloud/build.info
build_name: server
serial: 20160715

% grep FAIL /var/log/cloud-init.log
Jul 19 17:01:10 ubuntu [CLOUDINIT] handlers.py[DEBUG]: finish: modules-config/config-mcollective: FAIL: running config-mcollective with frequency once-per-instance
Jul 19 17:01:10 ubuntu [CLOUDINIT] handlers.py[DEBUG]: finish: modules-config: FAIL: running modules for config

% dpkg-query --show cloud-init
cloud-init 0.7.7~bzr1246-0ubuntu1~16.04.1

# The failed path results in installation of mcollective
# but with the installed config file moved to '.old'. Just clean
# up to make this more pristine.
% apt-get --purge remove mcollective; rm -Rf /etc/mcollective/

# enable proposed and update
% cat > enable-proposed <<"EOF"
#!/bin/sh
set -e
rel=$(lsb_release -sc)
awk '$1 == "deb" && $2 ~ /ubuntu.com/ {
  printf("%s %s %s-proposed main universe\n", $1, $2, rel); exit(0) };
  ' "rel=$rel" /etc/apt/sources.list |
    tee /etc/apt/sources.list.d/proposed.list
EOF

% sh ./enable-proposed
deb http://archive.ubuntu.com/ubuntu xenial-proposed main universe
% sudo apt-get update -q && sudo apt-get install cloud-init
% dpkg-query --show cloud-init
cloud-init 0.7.7~bzr1256-0ubuntu1~16.04.1

# similate first boot on pristine image.
# avoid the 'seed' dir in /var/lib/cloud as it is used by lxd
% sudo rm -Rf /var/log/cloud-init
% rm -Rf /var/lib/cloud/{data,handlers,instance,instances,scripts,sem}
% sudo reboot

### wait and re-attach to instance
$ while ! lxc exec $name -- test -e /run/cloud-init/result.json; do echo .; sleep 1; done
$ lxc exec "$name" /bin/bash
# PS1="% "

% dpkg-query --show mcollective
mcollective 2.6.0+dfsg-2.1
% grep WARN /var/log/cloud-init.log || echo no WARN
no WARN

% systemctl status mcollective
● mcollective.service - The Marionette Collective
   Loaded: loaded (/lib/systemd/system/mcollective.service; enabled; vendor pres
   Active: active (running) since Tue 2016-07-19 17:03:14 UTC; 3min 8s ago
 Main PID: 739 (ruby)
    Tasks: 3
   Memory: 9.8M
      CPU: 248ms
   CGroup: /system.slice/mcollective.service
           └─739 ruby /usr/sbin/mcollectived --config=/etc/mcollective/server.cf

Jul 19 17:03:14 mcollective0 systemd[1]: Starting The Marionette Collective...
Jul 19 17:03:14 mcollective0 systemd[1]: mcollective.service: Supervising proces
Jul 19 17:03:14 mcollective0 systemd[1]: Started The Marionette Collective.
Jul 19 17:03:16 mcollective0 systemd[1]: Started The Marionette Collective.

% ls --full-time -l /etc/mcollective/server.cfg
-rw-r--r-- 1 root root 828 2016-07-19 17:03:16.080913763 +0000 /etc/mcollective/server.cfg