diff options
author | Tomas Babej <tbabej@redhat.com> | 2013-06-10 14:43:24 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-07-17 13:49:59 +0200 |
commit | c81849712f8888e6f12b7c2b7ebfcf5d2294addd (patch) | |
tree | 62a6975af7ea67686cc36c274da2431d8b720148 /ipalib/frontend.py | |
parent | 2a9be928556e58a69b7ce7a3b7f0aebd8f4c23bc (diff) | |
download | freeipa-c81849712f8888e6f12b7c2b7ebfcf5d2294addd.tar.gz freeipa-c81849712f8888e6f12b7c2b7ebfcf5d2294addd.tar.xz freeipa-c81849712f8888e6f12b7c2b7ebfcf5d2294addd.zip |
Provide ipa-advise tool
Provides a pluggable framework for generating configuration
scriptlets and instructions for various machine setups and use
cases.
Creates a new ipa-advise command, available to root user
on the IPA server.
Also provides an example configuration plugin,
config-fedora-authconfig.
https://fedorahosted.org/freeipa/ticket/3670
Diffstat (limited to 'ipalib/frontend.py')
-rw-r--r-- | ipalib/frontend.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 427f68235..67ca7767c 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -1445,3 +1445,48 @@ class Updater(Method): ) return self.execute(**options) + + +class _AdviceOutput(object): + + def __init__(self): + self.content = [] + self.prefix = '# ' + self.options = None + + def comment(self, line): + self.content.append(self.prefix + line) + + def debug(self, line): + if self.options.verbose: + self.comment('DEBUG: ' + line) + + def command(self, line): + self.content.append(line) + + +class Advice(Plugin): + """ + Base class for advices, plugins for ipa-advise. + """ + + options = None + require_root = False + description = '' + + def __init__(self): + super(Advice, self).__init__() + self.log = _AdviceOutput() + + def set_options(self, options): + self.options = options + self.log.options = options + + def get_info(self): + """ + This method should be overriden by child Advices. + + Returns a string with instructions. + """ + + raise NotImplementedError |