aboutsummaryrefslogtreecommitdiff
path: root/share/hydra/nodes
blob: 6b9d1012a0ae205b765dd8e7d5b72342ee8f6c74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
#
# Node tool.
#

# Default node retrieval method
function hydra_get_nodes {
  # See http://www.mail-archive.com/puppet-users@googlegroups.com/msg01615.html
  if [ -d "$PUPPET/manifests/nodes/" ]; then
    files="$PUPPET/manifests/nodes/*"
  else
    files="`find $PUPPET -name 'nodes.pp'`"
  fi
  grep ^node $files | sed -e 's/^node //' | awk -F, '{for(i=1;i<=NF;i++) {print $i}}' | cut -d "'" -f2
}

# Load
source $APP_BASE/lib/hydra/functions || exit 1
hydra_config_load

# Validation
if [ -z "$PUPPET" ]; then
  echo "No PUPPET parameter defined at $HYDRA preferences."
  exit 1
fi

# Get nodes
hydra_get_nodes