diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-11-13 12:32:55 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-11-13 12:32:55 -0200 |
commit | 88fb3d2d1bcfdc2cf59ca908b80bc40292aa8ed0 (patch) | |
tree | 529e288bd5ed0c5d8990c4e8d1e9cbb5b434fd9a /share | |
parent | c8c013a4e9a6e051b96632e00ca0ef9d8dbd0204 (diff) | |
download | hydra-88fb3d2d1bcfdc2cf59ca908b80bc40292aa8ed0.tar.gz hydra-88fb3d2d1bcfdc2cf59ca908b80bc40292aa8ed0.tar.bz2 |
Initial working version for a node tool and misc changes
Diffstat (limited to 'share')
-rwxr-xr-x | share/hydra/nodes | 21 | ||||
-rwxr-xr-x | share/hydra/register | 12 |
2 files changed, 28 insertions, 5 deletions
diff --git a/share/hydra/nodes b/share/hydra/nodes index 93593e1..c7e4c4c 100755 --- a/share/hydra/nodes +++ b/share/hydra/nodes @@ -2,3 +2,24 @@ # # Node tool. # + +# Default node retrieval method +function hydra_get_nodes { + # See http://www.mail-archive.com/puppet-users@googlegroups.com/msg01615.html + grep ^node $* | sed -e 's/^node //' | awk -F, '{for(i=1;i<=NF;i++) {print $i}}' | cut -d "'" -f2 +} + +# Load functions +source $APP_BASE/lib/hydra/functions || exit 1 + +# Load config +hydra_config_load + +# Validation +if [ -z "$PUPPET" ]; then + echo "No PUPPET parameter defined at $HYDRA preferences." + exit 1 +fi + +# Get nodes +hydra_get_nodes $PUPPET/manifests/nodes/* diff --git a/share/hydra/register b/share/hydra/register index 5ef0a9d..e3d3ed6 100755 --- a/share/hydra/register +++ b/share/hydra/register @@ -3,10 +3,13 @@ # Register an existing hydra # -CONFIG="$HOME/.hydra/config" -PREFERENCES="$HOME/.hydra/$HYDRA" +# Load functions +source $APP_BASE/lib/hydra/functions || exit 1 + +# Command line arguments BASEDIR="$1" +# Validation if [ -z "$BASEDIR" ]; then echo "Usage: hydra [hydra] register <path>" exit 1 @@ -15,15 +18,14 @@ elif grep -q -e "^$HYDRA=" $CONFIG &> /dev/null; then exit 1 fi -# Folder setup -mkdir -p `dirname $CONFIG` - # Reparse basedir to force absolute folder BASEDIR="`cd $BASEDIR && pwd`" # Add entry echo "Registering hydra $HYDRA..." +mkdir -p $BASEDIR chmod 700 $BASEDIR +hydra_config_load echo "$HYDRA=\"$BASEDIR\"" >> $CONFIG # Puppet configuration |