← Back to team overview

yellow team mailing list archive

[Merge] lp:~bac/lp-tarmac-configs/lpset-integration into lp:~yellow/lp-tarmac-configs/tarmac-puppet

 

Brad Crittenden has proposed merging lp:~bac/lp-tarmac-configs/lpset-integration into lp:~yellow/lp-tarmac-configs/tarmac-puppet.

Requested reviews:
  Yellow Squad (yellow)

For more details, see:
https://code.launchpad.net/~bac/lp-tarmac-configs/lpset-integration/+merge/118413

Add Ubuntu charm, let tarmac user run as root as required by juju
-- 
https://code.launchpad.net/~bac/lp-tarmac-configs/lpset-integration/+merge/118413
Your team Yellow Squad is requested to review the proposed merge of lp:~bac/lp-tarmac-configs/lpset-integration into lp:~yellow/lp-tarmac-configs/tarmac-puppet.
=== modified file 'fabfile.py'
--- fabfile.py	2012-07-11 11:49:16 +0000
+++ fabfile.py	2012-08-06 19:14:52 +0000
@@ -69,7 +69,9 @@
         "scp -r {0} * {1}:".format(opts, host),
         "Copying files to the instance")
     _run_command_until_success(
-        "ssh {0} {1} sudo puppet apply tarmac.pp --templatedir=.".format(opts, host),
+        "ssh {0} {1} sudo puppet apply --debug --verbose "
+        "--logdest=/var/log/puppet/puppet.log "
+        "tarmac.pp --templatedir=.".format(opts, host),
         "Run puppet on the instance")
 
     puts("Tarmac deployed")

=== modified file 'tarmac-sudoers'
--- tarmac-sudoers	2012-08-03 13:05:18 +0000
+++ tarmac-sudoers	2012-08-06 19:14:52 +0000
@@ -1,4 +1,3 @@
-# Allow tarmac to run any commands as root in 'bin' in any of the
-# tarmac checkouts.
-tarmac ALL = (ALL) NOPASSWD: /home/tarmac/repos/lpsetup/*/bin/
+# Allow tarmac to run any commands as root.  Required for juju.
+tarmac ALL = (ALL) NOPASSWD: ALL
 

=== modified file 'tarmac.pp'
--- tarmac.pp	2012-08-03 13:46:13 +0000
+++ tarmac.pp	2012-08-06 19:14:52 +0000
@@ -56,9 +56,20 @@
      creates => "/etc/apt/sources.list.d/yellow-ppa-precise.list"
   }
 
+  exec { "ubuntu-charm":
+      command => "/usr/bin/bzr branch http://bazaar.launchpad.net/~charmers/charms/precise/ubuntu/trunk ubuntu",
+      user    => "tarmac",
+      cwd     => "$home/juju-charms/precise",
+      require => [File["$home/juju-charms/precise"], Package["bzr"]],
+      creates => "$home/juju-charms/precise/ubuntu",
+  }
   user { "tarmac":
-    home  => $home,
-    shell => "/bin/bash",
+    home       => $home,
+    ensure     => "present",
+    managehome => true,
+    shell      => "/bin/bash",
+    groups     => ['libvirtd'],
+    require    => Package["libvirt-bin"],
   }
 
   file { $home:
@@ -76,7 +87,7 @@
   exec { "tarmac-source":
     command => "/usr/bin/bzr checkout --lightweight lp:tarmac",
     user    => "tarmac",
-    cwd     => $home,
+    cwd     => "$home",
     require => [File[$home], Package["bzr"]],
     creates => "$home/tarmac",
   }
@@ -127,14 +138,21 @@
       owner   => "tarmac",
       require => File["$home/.ssh"],
       content => template("known_hosts");
+    "$home/juju-charms":
+      owner   => "tarmac",
+      require => File["$home"],
+      ensure  => directory;
+    "$home/juju-charms/precise":
+      owner   => "tarmac",
+      require => File["$home/juju-charms"],
+      ensure  => directory;
   }
   file { "/etc/sudoers.d/tarmac":
-      require => File["/etc/sudoers.d/tarmac"],
       content => template("tarmac-sudoers"),
       mode    => 0440;
   }
   file {
-    "$home/.juju": 
+    "$home/.juju":
       owner   => "tarmac",
       ensure  => directory,
       require => File["$home"];
@@ -164,7 +182,7 @@
     user        => "tarmac",
     minute      => "*",
     environment => ["PYTHONPATH=$home/tarmac", "TMPDIR=$tmp"],
-    require     => [User["tarmac"], File["$home/tarmac.lock"]]
+    require     => [User["tarmac"], File["$home/tarmac.lock"], Exec["ubuntu-charm"]],
   }
 }
 


Follow ups