summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2015-02-16 16:34:01 +0000
committerTomas Babej <tbabej@redhat.com>2015-03-05 11:01:36 +0100
commit2625efa727822addbaa469dbf5c680b0f62c43da (patch)
tree4b2793e9ba7a03838c6aa12630dc1ce66a757ddc /ipalib
parentdae6a1881354e57b58c79ffea0a75f524286855e (diff)
downloadfreeipa-2625efa727822addbaa469dbf5c680b0f62c43da.tar.gz
freeipa-2625efa727822addbaa469dbf5c680b0f62c43da.tar.xz
freeipa-2625efa727822addbaa469dbf5c680b0f62c43da.zip
advise: Add separate API object for ipa-advise
Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/__init__.py8
-rw-r--r--ipalib/frontend.py50
2 files changed, 2 insertions, 56 deletions
diff --git a/ipalib/__init__.py b/ipalib/__init__.py
index 381f38162..0b587904f 100644
--- a/ipalib/__init__.py
+++ b/ipalib/__init__.py
@@ -882,7 +882,7 @@ freeIPA.org:
import os
import plugable
from backend import Backend
-from frontend import Command, LocalOrRemote, Updater, Advice
+from frontend import Command, LocalOrRemote, Updater
from frontend import Object, Method
from crud import Create, Retrieve, Update, Delete, Search
from parameters import DefaultFrom, Bool, Flag, Int, Decimal, Bytes, Str, IA5Str, Password, DNParam, DeprecatedParam
@@ -909,8 +909,6 @@ class API(plugable.API):
self.packages.append('ipaserver')
if self.env.context in ('installer', 'updates'):
self.packages.append('ipaserver/install/plugins')
- if self.env.context in ('advise',):
- self.packages.append('ipaserver/advise/plugins')
def create_api(mode='dummy'):
@@ -926,11 +924,9 @@ def create_api(mode='dummy'):
- `frontend.Method`
- - `frontend.Advice`
-
- `backend.Backend`
"""
- api = API((Command, Object, Method, Backend, Updater, Advice))
+ api = API((Command, Object, Method, Backend, Updater))
if mode is not None:
api.env.mode = mode
assert mode != 'production'
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index e82a03a2a..36d9ab2d4 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -1406,53 +1406,3 @@ class Updater(Method):
)
return self.execute(**options)
-
-
-class _AdviceOutput(object):
-
- def __init__(self):
- self.content = []
- self.prefix = '# '
- self.options = None
-
- def comment(self, line, wrapped=True):
- if wrapped:
- for wrapped_line in wrap(line, 70):
- self.content.append(self.prefix + wrapped_line)
- else:
- 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)
-
-
-@register.base()
-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