Colin Copeland committed 2841089

fix locale-gen; switch order of virtualenv and distribute install; properly chown new authorized_keys files

Comments (0)

Files changed (1)


 import logging
 from mallet.bootstrap import apt
 from mallet.bootstrap.apt import lenny
-from mallet.utils import create_ssh, call, write, writelines
+from mallet.utils import create_ssh, call, write, writelines, chown
 from mallet.bootstrap.base import PackageGroup
 from libcloud.types import Provider
     packages = ['postgresql', 'postgresql-server-dev-8.4']
     def post_install(self, node_wrapper):
-        call(['local-gen', 'en_US.UTF-8'])
+        call(['locale-gen', 'en_US.UTF-8'])
         call(['update-locale', 'LANG=en_US.UTF-8'])
         call(['pg_dropcluster', '--stop', '8.4', 'main'])
         call(['pg_createcluster', '--start', '-e', 'UTF-8', '8.4', 'main'])
     def post_install(self, node_wrapper):
         call(['easy_install', '-U', 'pip'])
+        call(['pip', 'install', '-U', 'virtualenv'])
         call(['pip', 'install', '-U', 'distribute'])
-        call(['pip', 'install', '-U', 'virtualenv'])
 class Apache(lenny.Apache):
             config = env.cfg.config
             if config.has_option('mallet', 'public_key'):
                 ssh_dir = os.path.join('/', 'home', name, '.ssh')
-                call(['mkdir', '-p', ssh_dir])
+                call(['sudo', '-u', name, 'mkdir -p %s' % ssh_dir])
                 public_key = open(config.get('mallet', 'public_key')).read()
                 authorized_keys = os.path.join(ssh_dir, 'authorized_keys')
                 write(authorized_keys, public_key, append=True)
+                chown(authorized_keys, name)
             #'Setting password for user')
             # print 'Please choose a UNIX password for the "%s" user' % name