Commit 7aba03f2 authored by Fabien Combernous's avatar Fabien Combernous

Merge branch '103-bolt-task-should-handle-when-ipa-command-returns-2' into 'master'

Resolve "bolt task should handle when ipa command returns 2"

Closes #103

See merge request !112
parents 45e52d1f 439835f2
Pipeline #7860 passed with stages
in 53 minutes and 2 seconds
......@@ -20,7 +20,7 @@ _Private Classes_
**Tasks**
* [`manage_admin`](#manage_admin): Create a new FreeIPA admin account
* [`manage_admin`](#manage_admin): Manage (create or delete) a FreeIPA admin account
## Classes
......@@ -342,7 +342,7 @@ include freeipa::helpers::flushcache
### manage_admin
Create a new FreeIPA admin account
Manage (create or delete) a FreeIPA admin account
**Supports noop?** false
......
......@@ -27,7 +27,20 @@ describe 'manage_admin task' do
end
end
context 'with ensure absent' do
context 'with ensure absent on existing existing' do
it 'deletes admin account' do
# rubocop:disable Style/BracesAroundHashParameters
result = run_task(
'freeipa::manage_admin',
'master',
{ 'operator_login' => 'admin', 'operator_password' => 's^ecr@et.ea;R/O*=?j!.QsAu+$', 'ensure' => 'absent', 'login' => 'jaimarre' }
)
# rubocop:enable Style/BracesAroundHashParameters
expect(result.first).to include('status' => 'success')
end
end
context 'with ensure absent on NOT existing account' do
it 'deletes admin account' do
# rubocop:disable Style/BracesAroundHashParameters
result = run_task(
......
{
"puppet_task_version": 1,
"supports_noop": false,
"description": "Create a new FreeIPA admin account",
"description": "Manage (create or delete) a FreeIPA admin account",
"parameters": {
"operator_login": {
"description": "FreeIPA login of operator running the task",
......
......@@ -150,9 +150,13 @@ ipa_del_user() {
message 'user-del' $retval
if [ $retval -ne 0 ]; then
# EXIT STATUS extracted from man ipa
# 0 if the command was successful
# 1 if an error occurred
# 2 if an entry is not found
if [[ $retval -ne 0 ]] || [[ $retval -ne 2 ]]; then
krb_tgt destroy
exit $retval
exit 0
else
return $retval
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment