diff options
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/mic/plugin.py | 2 | ||||
| -rw-r--r-- | scripts/lib/mic/pluginbase.py | 45 | ||||
| -rw-r--r-- | scripts/lib/mic/plugins/hook/.py | 0 | ||||
| -rw-r--r-- | scripts/lib/mic/plugins/hook/empty_hook.py | 3 | ||||
| -rw-r--r-- | scripts/lib/mic/utils/errors.py | 21 |
5 files changed, 3 insertions, 68 deletions
diff --git a/scripts/lib/mic/plugin.py b/scripts/lib/mic/plugin.py index f836950727..43afdbc2f2 100644 --- a/scripts/lib/mic/plugin.py +++ b/scripts/lib/mic/plugin.py | |||
| @@ -24,7 +24,7 @@ from mic.utils.oe.misc import * | |||
| 24 | 24 | ||
| 25 | __ALL__ = ['PluginMgr', 'pluginmgr'] | 25 | __ALL__ = ['PluginMgr', 'pluginmgr'] |
| 26 | 26 | ||
| 27 | PLUGIN_TYPES = ["imager", "source"] # TODO "hook" | 27 | PLUGIN_TYPES = ["imager", "source"] |
| 28 | 28 | ||
| 29 | PLUGIN_DIR = "/lib/mic/plugins" # relative to scripts | 29 | PLUGIN_DIR = "/lib/mic/plugins" # relative to scripts |
| 30 | SCRIPTS_PLUGIN_DIR = "scripts" + PLUGIN_DIR | 30 | SCRIPTS_PLUGIN_DIR = "scripts" + PLUGIN_DIR |
diff --git a/scripts/lib/mic/pluginbase.py b/scripts/lib/mic/pluginbase.py index 9cf4c628d1..46a4f4a6b6 100644 --- a/scripts/lib/mic/pluginbase.py +++ b/scripts/lib/mic/pluginbase.py | |||
| @@ -40,45 +40,10 @@ class _Plugin(object): | |||
| 40 | def get_plugins(cls): | 40 | def get_plugins(cls): |
| 41 | return cls.plugins | 41 | return cls.plugins |
| 42 | 42 | ||
| 43 | |||
| 43 | class ImagerPlugin(_Plugin): | 44 | class ImagerPlugin(_Plugin): |
| 44 | mic_plugin_type = "imager" | 45 | mic_plugin_type = "imager" |
| 45 | 46 | ||
| 46 | @classmethod | ||
| 47 | def check_image_exists(self, destdir, apacking=None, | ||
| 48 | images=(), | ||
| 49 | release=None): | ||
| 50 | |||
| 51 | # if it's a packing file, reset images | ||
| 52 | if apacking: | ||
| 53 | images = [apacking] | ||
| 54 | |||
| 55 | # release option will override images | ||
| 56 | if release is not None: | ||
| 57 | images = [os.path.basename(destdir.rstrip('/'))] | ||
| 58 | destdir = os.path.dirname(destdir.rstrip('/')) | ||
| 59 | |||
| 60 | for name in images: | ||
| 61 | if not name: | ||
| 62 | continue | ||
| 63 | |||
| 64 | image = os.path.join(destdir, name) | ||
| 65 | if not os.path.exists(image): | ||
| 66 | continue | ||
| 67 | |||
| 68 | if msger.ask("Target image/dir: %s already exists, " | ||
| 69 | "clean up and continue?" % image): | ||
| 70 | if os.path.isdir(image): | ||
| 71 | shutil.rmtree(image) | ||
| 72 | else: | ||
| 73 | os.unlink(image) | ||
| 74 | else: | ||
| 75 | raise errors.Abort("Cancled") | ||
| 76 | |||
| 77 | def do_create(self): | ||
| 78 | pass | ||
| 79 | |||
| 80 | def do_chroot(self): | ||
| 81 | pass | ||
| 82 | 47 | ||
| 83 | class SourcePlugin(_Plugin): | 48 | class SourcePlugin(_Plugin): |
| 84 | mic_plugin_type = "source" | 49 | mic_plugin_type = "source" |
| @@ -133,12 +98,6 @@ class SourcePlugin(_Plugin): | |||
| 133 | """ | 98 | """ |
| 134 | msger.debug("SourcePlugin: do_prepare_partition: part: %s" % part) | 99 | msger.debug("SourcePlugin: do_prepare_partition: part: %s" % part) |
| 135 | 100 | ||
| 136 | class BackendPlugin(_Plugin): | ||
| 137 | mic_plugin_type="backend" | ||
| 138 | |||
| 139 | def addRepository(self): | ||
| 140 | pass | ||
| 141 | |||
| 142 | def get_plugins(typen): | 101 | def get_plugins(typen): |
| 143 | ps = ImagerPlugin.get_plugins() | 102 | ps = ImagerPlugin.get_plugins() |
| 144 | if typen in ps: | 103 | if typen in ps: |
| @@ -146,4 +105,4 @@ def get_plugins(typen): | |||
| 146 | else: | 105 | else: |
| 147 | return None | 106 | return None |
| 148 | 107 | ||
| 149 | __all__ = ['ImagerPlugin', 'BackendPlugin', 'SourcePlugin', 'get_plugins'] | 108 | __all__ = ['ImagerPlugin', 'SourcePlugin', 'get_plugins'] |
diff --git a/scripts/lib/mic/plugins/hook/.py b/scripts/lib/mic/plugins/hook/.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/mic/plugins/hook/.py +++ /dev/null | |||
diff --git a/scripts/lib/mic/plugins/hook/empty_hook.py b/scripts/lib/mic/plugins/hook/empty_hook.py deleted file mode 100644 index 397585d8c1..0000000000 --- a/scripts/lib/mic/plugins/hook/empty_hook.py +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | #!/usr/bin/python | ||
| 2 | |||
| 3 | # TODO: plugin base for hooks | ||
diff --git a/scripts/lib/mic/utils/errors.py b/scripts/lib/mic/utils/errors.py index 8d720f9080..38fda307cf 100644 --- a/scripts/lib/mic/utils/errors.py +++ b/scripts/lib/mic/utils/errors.py | |||
| @@ -43,29 +43,8 @@ class Usage(CreatorError): | |||
| 43 | class Abort(CreatorError): | 43 | class Abort(CreatorError): |
| 44 | keyword = '' | 44 | keyword = '' |
| 45 | 45 | ||
| 46 | class ConfigError(CreatorError): | ||
| 47 | keyword = '<config>' | ||
| 48 | |||
| 49 | class KsError(CreatorError): | 46 | class KsError(CreatorError): |
| 50 | keyword = '<kickstart>' | 47 | keyword = '<kickstart>' |
| 51 | 48 | ||
| 52 | class RepoError(CreatorError): | ||
| 53 | keyword = '<repo>' | ||
| 54 | |||
| 55 | class RpmError(CreatorError): | ||
| 56 | keyword = '<rpm>' | ||
| 57 | |||
| 58 | class MountError(CreatorError): | 49 | class MountError(CreatorError): |
| 59 | keyword = '<mount>' | 50 | keyword = '<mount>' |
| 60 | |||
| 61 | class SnapshotError(CreatorError): | ||
| 62 | keyword = '<snapshot>' | ||
| 63 | |||
| 64 | class SquashfsError(CreatorError): | ||
| 65 | keyword = '<squashfs>' | ||
| 66 | |||
| 67 | class BootstrapError(CreatorError): | ||
| 68 | keyword = '<bootstrap>' | ||
| 69 | |||
| 70 | class RuntimeError(CreatorError): | ||
| 71 | keyword = '<runtime>' | ||
