delete vm_create and replace by chroot
authorPaul Tonelli <paul.tonelli@logilab.fr>
Thu, 30 May 2013 14:01:49 +0200
changeset 142 5cc4bcca328b
parent 141 638c1ec12cbf
child 143 fbb305bc2f56
delete vm_create and replace by chroot the name vm_create is not useful anymore as the file contained only the chroot_exec function. Using a chroot module is better. - renamed the function to run (to match salt existing api) - correct the different calls to vm_create.chroot_exec
_modules/chroot.py
_modules/openstack_client.py
_modules/vm_create.py
ami_creator.sls
ami_pre/files.sls
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_modules/chroot.py	Thu May 30 14:01:49 2013 +0200
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+def run(path, command):
+    return __salt__['cmd.run']('chroot ' + path + ' ' + command)
+
+def run_all(path, command):
+    return __salt__['cmd.run_all']('chroot ' + path + ' ' + command)
+
+
--- a/_modules/openstack_client.py	Wed May 22 18:38:43 2013 +0200
+++ b/_modules/openstack_client.py	Thu May 30 14:01:49 2013 +0200
@@ -43,7 +43,7 @@
 
 def upload_file(filename, disk_format, other_params='', image_name=None):
     '''
-    upload image to glance, used in vm_create
+    upload image to glance
     '''
     g_client = _auth_glance()
     if image_name == None:
--- a/_modules/vm_create.py	Wed May 22 18:38:43 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-#!/usr/bin/env python
-
-def chroot_exec(path, command):
-    return __salt__['cmd.run_all']('chroot ' + path + ' ' + command)
-
-
--- a/ami_creator.sls	Wed May 22 18:38:43 2013 +0200
+++ b/ami_creator.sls	Thu May 30 14:01:49 2013 +0200
@@ -7,7 +7,7 @@
 
 chroot_variate:
     module.run:
-        - name: vm_create.chroot_exec
+        - name: chroot.run
         - path: /mnt/variation
         - command: salt-call  --local state.highstate
         - require:
--- a/ami_pre/files.sls	Wed May 22 18:38:43 2013 +0200
+++ b/ami_pre/files.sls	Thu May 30 14:01:49 2013 +0200
@@ -27,7 +27,7 @@
 
 chroot_apt_get_update:
     module.run:
-        - name: vm_create.chroot_exec
+        - name: chroot.run
         - path: /mnt/variation
         - command: apt-get update
         - require:
@@ -44,7 +44,7 @@
 
 chroot_install_salt:
     module.run:
-        - name: vm_create.chroot_exec
+        - name: chroot.run
         - path: /mnt/variation
         - command: apt-get --force-yes -y install salt-minion python-apt
         - require: