]> gitweb.fluxo.info Git - hydra.git/commitdiff
Newnode: do not require site.pp
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 19 Oct 2015 19:52:55 +0000 (17:52 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 19 Oct 2015 19:52:55 +0000 (17:52 -0200)
share/hydra/newnode

index 5fdd264a1a3810ad41eb645a736ed78b724bc37d..b375b8aad9dfdf62ec0327279c2da943d5879b7d 100755 (executable)
@@ -65,7 +65,7 @@ mkdir -p $HYDRA_FOLDER/puppet/hiera/node
 cp $YAML $HYDRA_FOLDER/puppet/hiera/node/$NODE.$DOMAIN.yaml
 
 # Setup secret YAML template
-mkdir $HYDRA_FOLDER/puppet/hiera/secrets/node
+mkdir -p $HYDRA_FOLDER/puppet/hiera/secrets/node
 echo "---" > $HYDRA_FOLDER/puppet/hiera/secrets/node/$NODE.$DOMAIN.yaml
 
 # Copy node template
@@ -79,6 +79,9 @@ sed -i -e "s/example.org/$DOMAIN/g" $HYDRA_FOLDER/puppet/manifests/nodes/$NODE.$
 # Add to git
 (
   cd $HYDRA_FOLDER/puppet
-  git add manifests/site.pp manifests/nodes/$NODE.pp hiera/node/$NODE.$DOMAIN.yaml
-  git add manifests/site.pp manifests/nodes/$NODE.pp hiera/secrets/node/$NODE.$DOMAIN.yaml
+  git add manifests/nodes/$NODE.pp hiera/node/$NODE.$DOMAIN.yaml hiera/secrets/node/$NODE.$DOMAIN.yaml
+
+  if [ -e 'manifests/site.pp' ]; then
+    git add manifests/site.pp
+  fi
 )