Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions spec/acceptance/st0287_check_db_table_sizes_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper_acceptance'
describe 'tasks' do
it 'table sizes output sucessfully' do
result = run_bolt_task('support_tasks::st0287_check_db_table_sizes', 'dbname' => 'all')
expect(result.stdout).to contain(%r{success})
end
end
5 changes: 4 additions & 1 deletion tasks/st0287_check_db_table_sizes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"description": "The name of the db to connect to",
"type": "Enum['pe-puppetdb', 'pe-postgres', 'pe-classifier', 'pe-rbac', 'pe-activity', 'pe-orchestrator', 'postgres', all]"
}
}
},
"implementations": [
{"name": "st0287_check_db_table_sizes.sh", "requirements": ["shell"], "files": ["bash_task_helper/files/task_helper.sh"], "input_method": "environment"}
]
}
9 changes: 5 additions & 4 deletions tasks/st0287_check_db_table_sizes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

declare PT_dbname
dbname=$PT_dbname
declare PT__installdir
source "$PT__installdir/bash_task_helper/files/task_helper.sh"

function getdbTables() {
path=$1
Expand Down Expand Up @@ -36,7 +38,7 @@ elif puppet resource service postgresql-* | grep -q running; then
dbname="puppetdb"
fi
else
echo "Node not running pe-postgresql or postgresql service, please select node which is."
success '{ "status": "success - Node not running pe-postgresql or postgresql service, please select node which is." }'
fi

#Run for the correct environment
Expand All @@ -51,8 +53,7 @@ fi
getdbTables "psql" "${dbname}" "${postgresservice}" "puppetdb"
;;
*)
echo "Cannot Determine if Puppet Enterprise or Puppet Open Source "
exit 1
fail "Cannot Determine if Puppet Enterprise or Puppet Open Source"
esac

echo " -- ST#0287 Task ended: $(date +%s) --"
success '{ "status": "success - Task completed" }'