From 8e171bb79d6a9c4e910052d0660768b53122f1db Mon Sep 17 00:00:00 2001 From: Beth Date: Sat, 5 Oct 2024 18:11:45 -0500 Subject: [PATCH] fixed some issue --- build_ansible.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build_ansible.sh b/build_ansible.sh index b2e17d4..e51cde9 100644 --- a/build_ansible.sh +++ b/build_ansible.sh @@ -39,7 +39,7 @@ if $regrab;then # update build_ansible file and update branch/timestamp info in current cp /tmp/build_ansible.sh /ansible/build_ansible.sh - echo ${branch}:$c_time > /ansible/current + echo ${branch}:`date +%s` > /ansible/current # verify the parent script is not build_ansible.sh (to prevent the possibility of recurring until the system crashes in the case of an issue) me=$(basename "$0") @@ -55,7 +55,7 @@ curl -k "https://git.actcur.com/actcur-ansible/playbook-builder/raw/branch/$bran # verify file was downloaded successfully count=`grep -P "end of file" /tmp/$fqdn | wc -l` -if [ "$count" != "2" ];then +if [ "$count" != "1" ];then echo "failed to grab current playbook build file for $fqdn, exiting" exit fi @@ -73,11 +73,10 @@ echo "- hosts: $fqdn roles:" > /ansible/new/$fqdn.yml -lines=`cat /tmp/$fqdn` -for line in $lines +while read line do elements=() - for element in $(echo $line | tr ";" "\n"); do elements+=("$e") + for element in $(echo $line | tr ";" "\n"); do elements+=("$e");done case ${elements[0]} in "role") # format role:role name:branch/tag to use @@ -111,7 +110,7 @@ do echo "entry: $line" ;; esac -done +done