mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
committed by
Petr Viktorin
parent
44998feace
commit
b1bffb5eca
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user