]> gitweb.fluxo.info Git - hydra.git/commitdiff
Initial code for 'hydra register'
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 18 Oct 2010 01:21:33 +0000 (23:21 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 18 Oct 2010 01:21:33 +0000 (23:21 -0200)
README
hydra
lib/hydra/functions
share/hydra/register
share/hydractl/init

diff --git a/README b/README
index 74b39b8caf7c09215afe6e7513b47d794af4eeb5..7b2858b98c2016cddf08321505dd89313767c2a7 100644 (file)
--- a/README
+++ b/README
@@ -1,2 +1,7 @@
 Hydra Process Command Tool
 ==========================
+
+This suite is made of two commands:
+
+  - hydractl: issues commands in the current host.
+  - hydra: issues commands on multiple hosts.
diff --git a/hydra b/hydra
index a7478301f0b660647a40a92dbc4eca1d019d6289..fcb3e626a130b4b8cdc9be6d09ed208cd3d0d7d4 100755 (executable)
--- a/hydra
+++ b/hydra
@@ -35,7 +35,7 @@ function hydra_load {
       base="`dirname $0`"
     fi
 
-    # Deal with relative or absolute link
+    # Deal with relative or absolute links
     if [ "`basename $dest`" == "$dest" ]; then
       export APP_BASE="$base"
     else
index ad5861e1ca8ca761154b509cfb4fa5fd1f3df376..0324bbb47175b609cd745bdfa3e4207832f89471 100644 (file)
@@ -3,8 +3,10 @@
 # Common functions.
 #
 
-# Setup environment
-hydra_set_env $*
+# Source required functions
 source $APP_BASE/lib/hydra/git
 source $APP_BASE/lib/hydra/misc
 source $APP_BASE/lib/hydra/tmpfile
+
+# Setup environment
+hydra_set_env $*
index 5364f58da558922753161da92132d61cbc9aee0a..bf36540544fa2389264fdc01b12a39120b7e66d4 100755 (executable)
@@ -1,3 +1,23 @@
 #!/bin/bash
+#
 # Register an existing hydra
-# TODO
+#
+
+CONFIG="$HOME/.hydra/config"
+HYDRA="$1"
+BASEDIR="$2"
+PUPPET="$(dirname `find $BASEDIR -name puppet.conf`)"
+
+mkdir -p `dirname $CONFIG`
+
+if grep -q -e "^$HYDRA=" $CONFIG; then
+  echo "Hydra $HYDRA already defined"
+  exit 1
+fi
+
+# Reparse basedir to force absolute folder
+BASEDIR="`cd $BASEDIR && pwd`"
+
+# Add entry
+chmod 700 $BASEDIR
+echo "$HYDRA=\"$BASEDIR\"" >> $CONFIG
index 6c8264a38114f9ced03a94c4f95990bf365bd1ce..06fd7542a73cdf80728f95372453bc94fd6aaa4e 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/bash
+#
+# Bootstrap a new hydra using the current host as a starting point.
+#
 
 hydractl backports
 hydractl install_puppet
@@ -6,7 +9,8 @@ hydractl install_puppet
 mkdir -p /etc/puppet/modules
 git clone git://git.sarava.org/puppet-bootstrap /etc/puppet/modules/bootstrap
 
-# TODO: edit /etc/puppet/modules/bootstrap/manifests/site.pp to suit your needs.
+echo "Editing /etc/puppet/modules/bootstrap/manifests/site.pp to suit your needs..."
+$EDITOR /etc/puppet/modules/bootstrap/manifests/site.pp
 
 puppetd --no-daemonize --debug --verbose --onetime /etc/puppet/modules/bootstrap/manifests/init.pp
 puppetd --no-daemonize --debug --verbose