#6478 ipa trust-fetch-domains returns correct output with exit status as 1
Closed: invalid Opened by pvoborni.

Ticket was cloned from Red Hat Bugzilla (product Red Hat Enterprise Linux 7): Bug 1391814

Description of problem: ipa trust-fetch-domains <domainname> returns correct
output with exit status as 1
Version-Release number of selected component (if applicable):
ipa-server-4.4.0-12.el7.x86_64
How reproducible: Always
Steps to Reproduce:
1. Install IPA server and establish two-way trust with windows AD having
subdomain.
2. Now run ipa trust-fetch-domains <domainname> and check the output on the
console.
Actual results:
[root@master ~]# ipa trust-find
---------------
1 trust matched
---------------
  Realm name: ipaad2008r2.test
  Domain NetBIOS name: IPAAD2008R2
  Domain Security Identifier: S-1-5-21-1765444267-4284514389-3232425237
  Trust type: Active Directory domain
----------------------------
Number of entries returned 1
----------------------------
[root@master ~]# ipa trustdomain-find
Realm name: ipaad2008r2.test
  Domain name: ipaad2008r2.test
  Domain NetBIOS name: IPAAD2008R2
  Domain Security Identifier: S-1-5-21-1765444267-4284514389-3232425237
  Domain enabled: True
  Domain name: ipasub2008r2-1.ipaad2008r2.test
  Domain NetBIOS name: IPASUB2008R2-1
  Domain Security Identifier: S-1-5-21-469193889-4273894478-2486872656
  Domain enabled: True
----------------------------
Number of entries returned 2
----------------------------
[root@master ~]# ipa trust-fetch-domains ipaad2008r2.test
-------------------------------
No new trust domains were found
-------------------------------
----------------------------
Number of entries returned 0
----------------------------
[root@master ~]# echo $?
1
3. Highlighting the failed testcase in beaker which expects return code 0.
========
:: [   LOG    ] :: Fetch trust domains with valid realm default enable all
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
:: [   PASS   ] :: Command 'kdestroy -A' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo Secret123 | kinit admin' (Expected 0, got 0)
:: [   PASS   ] :: Command 'ipa trustdomain-find ipaad2008r2.test
ipasub2008r2-1.ipaad2008r2.test' (Expected 0, got 0)
:: [   PASS   ] :: Command 'ipa idrange-find
IPASUB2008R2-1.IPAAD2008R2.TEST_id_range >
/tmp/tmp.MDcNn6KvWX/tmpout.trustdomain_cli_0018.out 2>&1' (Expected 0, got 0)
:: [   PASS   ] :: File '/tmp/tmp.MDcNn6KvWX/tmpout.trustdomain_cli_0018.out'
should contain 'Range name: IPASUB2008R2-1.IPAAD2008R2.TEST_id_range'
:: [   PASS   ] :: File '/tmp/tmp.MDcNn6KvWX/tmpout.trustdomain_cli_0018.out'
should contain 'Range type: Active Directory domain range'
:: [   PASS   ] :: Command 'sleep 10' (Expected 0, got 0)
:: [   LOG    ] :: Checking kadmin is fully up
:: [   PASS   ] :: Command 'date' (Expected 0, got 0)
:: [   LOG    ] :: kadmin is up
:: [   PASS   ] :: Command 'date' (Expected 0, got 0)
**************
:: [   FAIL   ] :: Command 'ipa trust-fetch-domains ipaad2008r2.test >
/tmp/tmp.MDcNn6KvWX/tmpout.trustdomain_cli_0018.out 2>&1' (Expected 0, got 1)
**************
:: [   PASS   ] :: File '/tmp/tmp.MDcNn6KvWX/tmpout.trustdomain_cli_0018.out'
should contain 'No new trust domains were found'
:: [   PASS   ] :: File '/tmp/tmp.MDcNn6KvWX/tmpout.trustdomain_cli_0018.out'
should contain 'Number of entries returned 0'
:: [   PASS   ] :: Command 'sleep 60' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 1m 16s
:: [   LOG    ] :: Assertions: 12 good, 1 bad
:: [   FAIL   ] :: RESULT: Fetch trust domains with valid realm default enable
all
Expected results: Exit status should be 0 if the output is displayed correctly.
without any error.
Additional info: Attaching the httpd error log and debug output for the command
when it was run.

Metadata Update from @pvoborni:
- Issue assigned to someone
- Issue set to the milestone: FreeIPA 4.5 backlog

Metadata Update from @tdudlak:
- Custom field component reset (from Trusts)
- Custom field rhbz reset (from https://bugzilla.redhat.com/show_bug.cgi?id=1391814)
- Custom field type reset (from defect)
- Issue close_status updated to: None

It is expected behaviour according to issue #325.

Metadata Update from @tdudlak:
- Issue assigned to tdudlak (was: someone)

Metadata Update from @tdudlak:
- Issue close_status updated to: invalid
- Issue status updated to: Closed (was: Open)

Metadata