Imported Upstream version 4.3.1
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
#! /usr/bin/python2
|
||||
|
||||
# Authors:
|
||||
# Petr Viktorin <pviktori@redhat.com>
|
||||
@@ -27,7 +27,7 @@ import argparse
|
||||
import json
|
||||
|
||||
from ipalib.constants import FQDN
|
||||
from ipatests.pytest_ipa.integration import config, env_config
|
||||
from ipatests.test_integration import config, env_config
|
||||
|
||||
|
||||
def main(argv):
|
||||
@@ -105,7 +105,7 @@ def get_object(conf, args):
|
||||
try:
|
||||
return conf.host_by_name(args.host)
|
||||
except LookupError:
|
||||
sys.exit('Host %s not found in config. Try --global' % args.host)
|
||||
exit('Host %s not found in config. Try --global' % args.host)
|
||||
else:
|
||||
if args.domain:
|
||||
try:
|
||||
@@ -113,18 +113,18 @@ def get_object(conf, args):
|
||||
except ValueError:
|
||||
domains = [d for d in conf.domains if d.name == args.domain]
|
||||
if not domains:
|
||||
sys.exit('Domain %s not found' % args.domain)
|
||||
exit('Domain %s not found' % args.domain)
|
||||
domain = domains[0]
|
||||
else:
|
||||
try:
|
||||
domain = conf.domains[num]
|
||||
except LookupError:
|
||||
sys.exit('Domain %s not found.' % args.domain)
|
||||
exit('Domain %s not found.' % args.domain)
|
||||
else:
|
||||
try:
|
||||
domain = conf.domains[0]
|
||||
except IndexError:
|
||||
sys.exit('No domains are configured.')
|
||||
exit('No domains are configured.')
|
||||
if args.master:
|
||||
return domain.master
|
||||
|
||||
@@ -133,29 +133,23 @@ def get_object(conf, args):
|
||||
try:
|
||||
return domain.replicas[args.replica]
|
||||
except LookupError:
|
||||
sys.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:
|
||||
sys.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:
|
||||
sys.exit(
|
||||
'No host with role %s not found in domain %s'
|
||||
% (args.role, domain.name)
|
||||
)
|
||||
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