summaryrefslogtreecommitdiffstats
path: root/ipatests/ipa-test-config
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2013-10-16 13:54:26 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-10-31 16:52:12 +0100
commitb1bffb5ecad0fdaa2f560efd2b75c76bedc4423c (patch)
tree791e5708660c6b873e497f345b9c6639af108852 /ipatests/ipa-test-config
parent44998feace93a01b3dfda8fce6ff7aa35fffbabf (diff)
downloadfreeipa-b1bffb5ecad0fdaa2f560efd2b75c76bedc4423c.tar.gz
freeipa-b1bffb5ecad0fdaa2f560efd2b75c76bedc4423c.tar.xz
freeipa-b1bffb5ecad0fdaa2f560efd2b75c76bedc4423c.zip
ipatests: Add support for extra roles referenced by a keyword
Adds support for host definition by a environment variables of the following form: ROLE_<keyword>_envX, where X is the number of the environment for which host referenced by a role <keyword> should be defined. Adds a required_extra_roles attribute to the IntegrationTest class, which can test developer use to specify the extra roles that this particular test requires. If not all required extra roles are available, the test will be skipped. All extra (and static) roles are accessible to the IntegrationTests via the host_by_role method, which returns a host of given role. Part of: https://fedorahosted.org/freeipa/ticket/3833
Diffstat (limited to 'ipatests/ipa-test-config')
-rwxr-xr-xipatests/ipa-test-config19
1 files changed, 17 insertions, 2 deletions
diff --git a/ipatests/ipa-test-config b/ipatests/ipa-test-config
index ce1f55b5f..fbaf3d57a 100755
--- a/ipatests/ipa-test-config
+++ b/ipatests/ipa-test-config
@@ -52,6 +52,9 @@ def main(argv):
parser.add_argument('--client', type=int,
help='Print config for the client with this number')
+ parser.add_argument('--role', type=str,
+ help='Print config for machine with this role')
+
parser.add_argument('--no-simple', dest='simple', action='store_false',
help='Do not print Simple Vars '
'(normally included backwards-compatibility)')
@@ -106,18 +109,30 @@ def get_object(conf, args):
exit('No domains are configured.')
if args.master:
return domain.master
+
elif args.replica:
num = int(args.replica) - 1
try:
return domain.replicas[args.replica]
except LookupError:
- exit('Domain %s not found in domain %s' % (args.replica, domain.name))
+ exit('Domain %s not found in domain %s' % (args.replica,
+ domain.name))
+
elif args.client:
num = int(args.client) - 1
try:
return domain.replicas[args.client]
except LookupError:
- exit('Client %s not found in domain %s' % (args.client, domain.name))
+ exit('Client %s not found in domain %s' % (args.client,
+ domain.name))
+
+ elif args.role:
+ try:
+ return domain.get_host_by_role(args.role)
+ except LookupError:
+ exit('No host with role %s not found in domain %s'
+ % (args.role, domain.name))
+
else:
return domain