|
|
2e9388 |
From 4ab54ece01d015f6b4e58542e377f60bc6726815 Mon Sep 17 00:00:00 2001
|
|
|
2e9388 |
From: Jan Cholasta <jcholast@redhat.com>
|
|
|
2e9388 |
Date: Mon, 2 Nov 2015 15:32:35 +0100
|
|
|
2e9388 |
Subject: [PATCH] install: fix command line option validation
|
|
|
2e9388 |
|
|
|
2e9388 |
The code which calls the validators was accidentally removed, re-add it.
|
|
|
2e9388 |
|
|
|
2e9388 |
https://fedorahosted.org/freeipa/ticket/5386
|
|
|
2e9388 |
https://fedorahosted.org/freeipa/ticket/5391
|
|
|
2e9388 |
https://fedorahosted.org/freeipa/ticket/5392
|
|
|
2e9388 |
|
|
|
2e9388 |
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
|
|
|
2e9388 |
---
|
|
|
2e9388 |
ipapython/install/cli.py | 7 +++++--
|
|
|
2e9388 |
ipapython/install/core.py | 3 ++-
|
|
|
2e9388 |
2 files changed, 7 insertions(+), 3 deletions(-)
|
|
|
2e9388 |
|
|
|
2e9388 |
diff --git a/ipapython/install/cli.py b/ipapython/install/cli.py
|
|
|
2e9388 |
index 1ba9a815c4c499dff0e7974f399f2de31eb932cd..f6cc0fc351fd1f9fc3f51987bbb938deca377fe1 100644
|
|
|
2e9388 |
--- a/ipapython/install/cli.py
|
|
|
2e9388 |
+++ b/ipapython/install/cli.py
|
|
|
2e9388 |
@@ -275,7 +275,8 @@ class ConfigureTool(admintool.AdminTool):
|
|
|
2e9388 |
kwargs = {}
|
|
|
2e9388 |
|
|
|
2e9388 |
transformed_cls = self._transform(self.configurable_class)
|
|
|
2e9388 |
- for owner_cls, name in transformed_cls.knobs():
|
|
|
2e9388 |
+ knob_classes = {n: getattr(c, n) for c, n in transformed_cls.knobs()}
|
|
|
2e9388 |
+ for name in knob_classes:
|
|
|
2e9388 |
value = getattr(self.options, name, None)
|
|
|
2e9388 |
if value is not None:
|
|
|
2e9388 |
kwargs[name] = value
|
|
|
2e9388 |
@@ -287,8 +288,10 @@ class ConfigureTool(admintool.AdminTool):
|
|
|
2e9388 |
try:
|
|
|
2e9388 |
cfgr = transformed_cls(**kwargs)
|
|
|
2e9388 |
except core.KnobValueError as e:
|
|
|
2e9388 |
- knob_cls = getattr(transformed_cls, e.name)
|
|
|
2e9388 |
+ knob_cls = knob_classes[e.name]
|
|
|
2e9388 |
try:
|
|
|
2e9388 |
+ if self.positional_arguments is None:
|
|
|
2e9388 |
+ raise IndexError
|
|
|
2e9388 |
index = self.positional_arguments.index(e.name)
|
|
|
2e9388 |
except IndexError:
|
|
|
2e9388 |
cli_name = knob_cls.cli_name or e.name.replace('_', '-')
|
|
|
2e9388 |
diff --git a/ipapython/install/core.py b/ipapython/install/core.py
|
|
|
2e9388 |
index c313c278e09cbf68e4f5c4b4c57f00d6e2870bea..91ae854cdb2a8846e2a2673a5bfe54b4f75f3823 100644
|
|
|
2e9388 |
--- a/ipapython/install/core.py
|
|
|
2e9388 |
+++ b/ipapython/install/core.py
|
|
|
2e9388 |
@@ -226,7 +226,8 @@ class Configurable(object):
|
|
|
2e9388 |
except KeyError:
|
|
|
2e9388 |
pass
|
|
|
2e9388 |
else:
|
|
|
2e9388 |
- setattr(self, name, value)
|
|
|
2e9388 |
+ prop = knob_cls(self)
|
|
|
2e9388 |
+ prop.__set__(self, value)
|
|
|
2e9388 |
|
|
|
2e9388 |
if kwargs:
|
|
|
2e9388 |
extra = sorted(kwargs.keys())
|
|
|
2e9388 |
--
|
|
|
2e9388 |
2.4.3
|
|
|
2e9388 |
|