mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Rework config.py and change cli tools. Maintain order of IPA servers from command line, config and DNS. Parse options before detecting IPA configuration. Don't ignore rest of the options if one is missing in ipa.conf. Drop the --usage options, we will rely on --help. Fixes: 458869, 459070, 458980, 459234
This commit is contained in:
@@ -81,13 +81,15 @@ def main():
|
||||
|
||||
opt_parser.set_usage("Usage: %s [options] %s" % (distinguished_attr, os.path.basename(sys.argv[0])))
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = opt_parser.parse_args(args)
|
||||
ipa.config.add_standard_options(opt_parser)
|
||||
options, args = opt_parser.parse_args()
|
||||
|
||||
if len(args) < 2:
|
||||
if len(args) < 1:
|
||||
opt_parser.error('missing %s' % (distinguished_attr))
|
||||
|
||||
ip_addr = args[1]
|
||||
ipa.config.init_config(options)
|
||||
|
||||
ip_addr = args[0]
|
||||
pairs[distinguished_attr] = ip_addr
|
||||
|
||||
# Get pairs from a file or stdin
|
||||
|
||||
@@ -77,13 +77,15 @@ def main():
|
||||
|
||||
opt_parser.set_usage("Usage: %s [options] %s" % (distinguished_attr, os.path.basename(sys.argv[0])))
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = opt_parser.parse_args(args)
|
||||
ipa.config.add_standard_options(opt_parser)
|
||||
options, args = opt_parser.parse_args()
|
||||
|
||||
if len(args) < 2:
|
||||
if len(args) < 1:
|
||||
opt_parser.error('missing %s' % (distinguished_attr))
|
||||
|
||||
uid = args[1]
|
||||
ipa.config.init_config(options)
|
||||
|
||||
uid = args[0]
|
||||
user_profile = not options.shared
|
||||
pairs[distinguished_attr] = uid
|
||||
|
||||
|
||||
@@ -46,13 +46,15 @@ def main():
|
||||
help="detailed help information")
|
||||
opt_parser.set_usage("Usage: %s [options] Client-IP-Address" % (os.path.basename(sys.argv[0])))
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = opt_parser.parse_args(args)
|
||||
ipa.config.add_standard_options(opt_parser)
|
||||
options, args = opt_parser.parse_args()
|
||||
|
||||
if len(args) < 2:
|
||||
if len(args) < 1:
|
||||
opt_parser.error("missing Client-IP-Address")
|
||||
|
||||
ip_addr = args[1]
|
||||
ipa.config.init_config(options)
|
||||
|
||||
ip_addr = args[0]
|
||||
|
||||
try:
|
||||
ipa_client = ipaclient.IPAClient()
|
||||
|
||||
@@ -48,13 +48,15 @@ def main():
|
||||
help="detailed help information")
|
||||
opt_parser.set_usage("Usage: %s [options] UID" % (os.path.basename(sys.argv[0])))
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = opt_parser.parse_args(args)
|
||||
ipa.config.add_standard_options(opt_parser)
|
||||
options, args = opt_parser.parse_args()
|
||||
|
||||
if len(args) < 2:
|
||||
if len(args) < 1:
|
||||
opt_parser.error("missing UID")
|
||||
|
||||
uid = args[1]
|
||||
ipa.config.init_config(options)
|
||||
|
||||
uid = args[0]
|
||||
user_profile = not options.shared
|
||||
|
||||
# Per user profiles are pre-created (i.e. objectclass radiusprofile is always added for each user)
|
||||
|
||||
@@ -56,15 +56,17 @@ def main():
|
||||
opt_parser.add_option("-h", "--help", action="callback", callback=help_option_callback,
|
||||
help="detailed help information")
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = opt_parser.parse_args(args)
|
||||
ipa.config.add_standard_options(opt_parser)
|
||||
options, args = opt_parser.parse_args()
|
||||
|
||||
opt_parser.set_usage("Usage: %s [options] Client-IP-Address [Client-IP-Address ...]" % (os.path.basename(sys.argv[0])))
|
||||
|
||||
if len(args) < 2:
|
||||
if len(args) < 1:
|
||||
opt_parser.error("missing Client-IP-Address(es)")
|
||||
|
||||
ip_addrs = args[1:]
|
||||
ipa.config.init_config(options)
|
||||
|
||||
ip_addrs = args
|
||||
|
||||
try:
|
||||
ipa_client = ipaclient.IPAClient()
|
||||
|
||||
@@ -58,15 +58,17 @@ def main():
|
||||
opt_parser.add_option("-h", "--help", action="callback", callback=help_option_callback,
|
||||
help="detailed help information")
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = opt_parser.parse_args(args)
|
||||
ipa.config.add_standard_options(opt_parser)
|
||||
options, args = opt_parser.parse_args()
|
||||
|
||||
opt_parser.set_usage("Usage: %s [options] UID [UID ...]" % (os.path.basename(sys.argv[0])))
|
||||
|
||||
if len(args) < 2:
|
||||
if len(args) < 1:
|
||||
opt_parser.error("missing UID(es)")
|
||||
|
||||
uids = args[1:]
|
||||
ipa.config.init_config(options)
|
||||
|
||||
uids = args
|
||||
user_profile = not options.shared
|
||||
|
||||
try:
|
||||
|
||||
@@ -82,13 +82,15 @@ def main():
|
||||
|
||||
opt_parser.set_usage("Usage: %s [options] %s" % (distinguished_attr, os.path.basename(sys.argv[0])))
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = opt_parser.parse_args(args)
|
||||
ipa.config.add_standard_options(opt_parser)
|
||||
options, args = opt_parser.parse_args()
|
||||
|
||||
if len(args) < 2:
|
||||
if len(args) < 1:
|
||||
opt_parser.error('missing %s' % (distinguished_attr))
|
||||
|
||||
ip_addr = args[1]
|
||||
ipa.config.init_config(options)
|
||||
|
||||
ip_addr = args[0]
|
||||
|
||||
# Verify entity previously exists and get current values
|
||||
ipa_client = ipaclient.IPAClient()
|
||||
|
||||
@@ -78,13 +78,15 @@ def main():
|
||||
|
||||
opt_parser.set_usage("Usage: %s [options] %s" % (distinguished_attr, os.path.basename(sys.argv[0])))
|
||||
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = opt_parser.parse_args(args)
|
||||
ipa.config.add_standard_options(opt_parser)
|
||||
options, args = opt_parser.parse_args()
|
||||
|
||||
if len(args) < 2:
|
||||
if len(args) < 1:
|
||||
opt_parser.error('missing %s' % (distinguished_attr))
|
||||
|
||||
uid = args[1]
|
||||
ipa.config.init_config(options)
|
||||
|
||||
uid = args[0]
|
||||
user_profile = not options.shared
|
||||
|
||||
# Verify entity previously exists and get current values
|
||||
|
||||
Reference in New Issue
Block a user