]> gitweb.fluxo.info Git - hydra.git/commitdiff
Get node list via hiera files
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 6 Mar 2016 01:58:54 +0000 (22:58 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 6 Mar 2016 01:58:54 +0000 (22:58 -0300)
TODO.md
share/hydra/nodes

diff --git a/TODO.md b/TODO.md
index b731ad7fe869baa370ed9b12f92d448c8fdaf084..c148595ee564dbb9bf6c52dd3454b93d0cf5520c 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -7,7 +7,6 @@ Hydra
 - install: move to /usr/local/share/hydra.
 - bootless: properly support `$subdevice` in parted or always use first partition (like `/dev/sdb1`).
 - init: add new repositories as superproject's submodules.
-- nodes: get node list via hiera files.
 - newnode: do not generate manifest file, only hiera.
 - deploy:
   - fix /etc/puppet permissions.
index b070680934815787eaee4dc556bbd2218ebcc495..4ddf9165381ea6509771f768415720e7f7de8ac0 100755 (executable)
 
 # Get a list of puppet node files
 function hydra_node_files {
-  if [ -d "$PUPPET/manifests/nodes/" ]; then
+  if [ -d "$PUPPET/hiera/node/" ]; then
+    FILES="$PUPPET/hiera/node/*"
+  elif [ -d "$PUPPET/manifests/nodes/" ]; then
     FILES="$PUPPET/manifests/nodes/*"
   else
     FILES="`find $PUPPET -name 'nodes.pp'`"
   fi
 }
 
+# Get using the filename
+function hydra_node_names {
+  for file in $FILES; do
+    basename $file .yaml
+  done
+}
+
 # Get all lines matching a node definition
 function hydra_node_lines {
   # See http://www.mail-archive.com/puppet-users@googlegroups.com/msg01615.html
@@ -33,7 +42,7 @@ function hydra_node_lines {
 
 # Default node retrieval method
 function hydra_nodes {
-  hydra_node_lines | cut -d "'" -f2
+  hydra_node_names
 }
 
 # Load