two modifications:
authorPaul Tonelli <paul.tonelli@logilab.fr>
Tue, 26 Mar 2013 12:10:22 +0100
changeset 96 077e05a2ce8e
parent 95 3802b216e62d
child 97 ae24ced33f8e
two modifications: - path of final files modified to : /mnt/output/ instead of /mnt - added the upload to glance procedure, this should be done at the end and not in the main ami_creation sls
ami_creator.sls
ami_post/init.sls
--- a/ami_creator.sls	Mon Mar 25 16:19:37 2013 +0100
+++ b/ami_creator.sls	Tue Mar 26 12:10:22 2013 +0100
@@ -1,33 +1,35 @@
 # /srv/salt/init_machine.sls
-preparation:
-    sls:
-        - ami_pre
-    require:
-        - hg.latest: hg_code
+
+#include:
+#    - ami_pre
+#preparation:
+#    sls:
+#        - ami_pre
+#    require:
+#        - hg.latest: hg_code
 
 update_variant:
-    grains.present: 
-        - value: {{ salt['vm_create.update_image']('/mnt/variation') }}
-    require:
-        - preparation
+    module.run:
+        - name: vm_create.update_image
+        - path: /mnt/variation
+#    require:
+#        - ami_pre.mount.mounted: mounted_variation
+#        - ami_pre.mount.mounted: chroot_proc 
+#        - ami_pre.mount.mounted: chroot_devpts
+#        - ami_pre: resolvconf 
 
 variate_variant:
-    grains.present: 
-        - value: {{ salt['vm_create.variate_image']('/mnt/variation') }}
-    require:
-        - update_variant
-
-cleaning:
-    sls:
-        - ami_post
+    module.run:
+        - name: vm_create.variate_image
+        - path: /mnt/variation
     require:
-        - variate_variant
+        - module.run: vm_create.update_image
 
-{% if  grains['keystone.user'] %}
-upload_variant:
-    grains.present: 
-        - value: {{ salt['vm_create.upload_to_glance']('/mnt/variation') }}
-    require:
-        - cleaning
-{% endif %}
+#include:
+#    - ami_post
+#cleaning:
+#    sls:
+#        - ami_post
+#    require:
+#        - vm_create.variate_image
 
--- a/ami_post/init.sls	Mon Mar 25 16:19:37 2013 +0100
+++ b/ami_post/init.sls	Tue Mar 26 12:10:22 2013 +0100
@@ -38,14 +38,14 @@
 {% for file in salt['file.find'](chroot + '/boot/', iname='vmlinuz*') %}
 kernel:
     tmp_state.local_managed:
-        - name: /mnt/kernel_variation
+        - name: /mnt/output/kernel_variation
         - source: {{ file }}
 {% endfor %}
 
 {% for file in salt['file.find'](chroot + '/boot/', iname='initrd*') %}
 initrd:
     tmp_state.local_managed:
-        - name: /mnt/ramdisk_variation
+        - name: /mnt/output/ramdisk_variation
         - source: {{ file }}
 {% endfor %}
 
@@ -81,7 +81,17 @@
 ### Resize the partition to min ###
 resize_variation:
     tmp_state.resized:
-        - name: {{ chroot }}.img
+        - name: /mnt/output/variation.img
         - require:
             - tmp_state.unmounted: umount_chroot_slash
 
+{% if 'keystone.user' in grains %}
+upload_variant:
+    module.run:
+        - name: vm_create.upload_to_glance
+        - path: /mnt/output
+    require:
+        - tmp_state.resized: resize_variation
+{% endif %}
+
+