Fix #104. Remove "enabled" from plugin manifests

This commit is contained in:
Anders Ingemann 2013-11-21 16:00:59 +01:00
parent 663b868b41
commit 71be571f93
7 changed files with 11 additions and 27 deletions

View file

@ -44,13 +44,7 @@
"type": "object",
"patternProperties": {
"^\\w+$": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
},
"required": ["enabled"]
"type": "object"
}
},
"additionalProperties": false

View file

@ -57,14 +57,13 @@ class Manifest(object):
self.loaded_plugins = []
if 'plugins' in data:
for plugin_name, plugin_data in data['plugins'].iteritems():
if plugin_data['enabled']:
modname = 'plugins.{plugin_name}'.format(plugin_name=plugin_name)
plugin = __import__(modname, fromlist=['plugins'])
init = getattr(plugin, 'initialize', None)
if callable(init):
init()
log.debug('Loaded plugin `%s\'', plugin_name)
self.loaded_plugins.append(plugin)
validate = getattr(plugin, 'validate_manifest', None)
if callable(validate):
validate(data, self.schema_validate)
modname = 'plugins.{plugin_name}'.format(plugin_name=plugin_name)
plugin = __import__(modname, fromlist=['plugins'])
init = getattr(plugin, 'initialize', None)
if callable(init):
init()
log.debug('Loaded plugin `%s\'', plugin_name)
self.loaded_plugins.append(plugin)
validate = getattr(plugin, 'validate_manifest', None)
if callable(validate):
validate(data, self.schema_validate)

View file

@ -32,16 +32,13 @@
},
"plugins": {
"backports": {
"enabled": true,
"packages": [ "cloud-init" ]
},
"user_packages": {
"enabled": true,
"repo": [ "sudo" ],
"local": []
},
"sed": {
"enabled": true,
"file": "etc/cloud/cloud.cfg",
"find": "^ name: debian$",
"replace": " name: admin\n sudo: ALL=(ALL) NOPASSWD:ALL\n shell: /bin/bash"

View file

@ -32,16 +32,13 @@
},
"plugins": {
"backports": {
"enabled": true,
"packages": [ "cloud-init" ]
},
"user_packages": {
"enabled": true,
"repo": [ "sudo" ],
"local": []
},
"sed": {
"enabled": true,
"file": "etc/cloud/cloud.cfg",
"find": "^ name: debian$",
"replace": " name: admin\n sudo: ALL=(ALL) NOPASSWD:ALL\n shell: /bin/bash"

View file

@ -4,7 +4,6 @@ Supported formats are the one supported by qemu-img.
In the plugins section add:
"convert_image": {
"enabled": true,
"format": "vdi"
}

View file

@ -5,7 +5,6 @@ This plugin gives the possibility to the user to execute commands.
Plugin is defined in the manifest file, plugin section with:
"image_commands": {
"enabled": true,
"commands": [ [ "touch", "/var/www/index.html" ]],
}

View file

@ -5,7 +5,6 @@ This plugin gives the possibility to the user to install Debian packages in the
Plugin is defined in the manifest file, plugin section with:
"user_packages": {
"enabled": true,
"repo": [ "apache2" ],
"local": [ "/tmp/mypackage.deb" ]
}