diff options
-rw-r--r-- | ipa.spec.in | 1 | ||||
-rw-r--r-- | ipalib/cli.py | 4 | ||||
-rw-r--r-- | ipalib/config.py | 2 | ||||
-rw-r--r-- | ipalib/errors.py | 10 |
4 files changed, 16 insertions, 1 deletions
diff --git a/ipa.spec.in b/ipa.spec.in index 46e5c35c8..4fb2ff7ee 100644 --- a/ipa.spec.in +++ b/ipa.spec.in @@ -153,6 +153,7 @@ this package should be installed on every client machine. Summary: IPA administrative tools Group: System Environment/Base Requires: %{name}-python = %{version}-%{release} +Requires: %{name}-client = %{version}-%{release} Requires: python-krbV Requires: python-ldap diff --git a/ipalib/cli.py b/ipalib/cli.py index 44f9c813c..dff709af0 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -37,7 +37,7 @@ import frontend import backend import plugable import util -from errors import PublicError, CommandError, HelpError, InternalError, NoSuchNamespaceError, ValidationError, NotFound +from errors import PublicError, CommandError, HelpError, InternalError, NoSuchNamespaceError, ValidationError, NotFound, NotConfiguredError from constants import CLI_TAB from parameters import Password, Bytes, File from text import _ @@ -945,6 +945,8 @@ def run(api): api.register(klass) api.load_plugins() api.finalize() + if not 'config_loaded' in api.env: + raise NotConfiguredError() sys.exit(api.Backend.cli.run(argv)) except KeyboardInterrupt: print '' diff --git a/ipalib/config.py b/ipalib/config.py index 1dbd5b7ce..91a189642 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -389,6 +389,8 @@ class Env(object): if key not in self: self[key] = value i += 1 + if 'config_loaded' not in self: # we loaded at least 1 file + self['config_loaded'] = True return (i, len(items)) def _join(self, key, *parts): diff --git a/ipalib/errors.py b/ipalib/errors.py index 42d43ce64..b960ffc75 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -746,6 +746,7 @@ class PasswordMismatch(InvocationError): errno = 3011 format = _('Passwords do not match') + class NotImplementedError(InvocationError): """ **3012** Raise when a function hasn't been implemented. @@ -755,6 +756,15 @@ class NotImplementedError(InvocationError): format = _('Command not implemented') +class NotConfiguredError(InvocationError): + """ + **3013** Raise when there is no configuration + """ + + errno = 3013 + format = _('Client is not configured. Run ipa-client-install.') + + ############################################################################## # 4000 - 4999: Execution errors |