mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00
Fix image_commands and user_packages plugins
This commit is contained in:
parent
302efea55c
commit
86fa48f201
6 changed files with 67 additions and 34 deletions
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
|
|
||||||
def tasks(tasklist, manifest):
|
|
||||||
from image_commands import ImageExecuteCommand
|
|
||||||
tasklist.add(ImageExecuteCommand())
|
|
||||||
|
|
||||||
def validate_manifest(data, schema_validate):
|
def validate_manifest(data, schema_validate):
|
||||||
from os import path
|
from os import path
|
||||||
schema_path = path.normpath(path.join(path.dirname(__file__), 'manifest-schema.json'))
|
schema_path = path.normpath(path.join(path.dirname(__file__), 'manifest-schema.json'))
|
||||||
schema_validate(data, schema_path)
|
schema_validate(data, schema_path)
|
||||||
|
|
||||||
|
|
||||||
|
def tasks(tasklist, manifest):
|
||||||
|
from image_commands import ImageExecuteCommand
|
||||||
|
tasklist.add(ImageExecuteCommand)
|
||||||
|
|
|
@ -12,11 +12,8 @@ class ImageExecuteCommand(Task):
|
||||||
for user_cmd in info.manifest.plugins['image_commands']['commands']:
|
for user_cmd in info.manifest.plugins['image_commands']['commands']:
|
||||||
command = []
|
command = []
|
||||||
for elt in user_cmd:
|
for elt in user_cmd:
|
||||||
fragment = elt.format(
|
fragment = elt.format(root=info.root,
|
||||||
root=info.root,
|
|
||||||
image=info.loopback_file,
|
image=info.loopback_file,
|
||||||
filesystem=info.manifest.volume['filesystem'])
|
filesystem=info.manifest.volume['filesystem'])
|
||||||
command.append(fragment)
|
command.append(fragment)
|
||||||
log_check_call(command)
|
log_check_call(command)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {"type": "string"},
|
||||||
"type": "string"
|
"minItems": 1
|
||||||
}
|
},
|
||||||
}
|
"minItems": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["commands"]
|
"required": ["commands"]
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
|
|
||||||
|
|
||||||
|
def validate_manifest(data, schema_validate):
|
||||||
|
from os import path
|
||||||
|
schema_path = path.normpath(path.join(path.dirname(__file__), 'manifest-schema.json'))
|
||||||
|
schema_validate(data, schema_path)
|
||||||
|
|
||||||
|
|
||||||
def tasks(tasklist, manifest):
|
def tasks(tasklist, manifest):
|
||||||
from user_packages import AddUserPackages, AddLocalUserPackages
|
from user_packages import AddUserPackages, AddLocalUserPackages
|
||||||
tasklist.add(AddUserPackages,
|
if 'repo' in manifest.plugins['user_packages']:
|
||||||
AddLocalUserPackages)
|
tasklist.add(AddUserPackages)
|
||||||
|
if 'local' in manifest.plugins['user_packages']:
|
||||||
|
tasklist.add(AddLocalUserPackages)
|
||||||
|
|
33
plugins/user_packages/manifest-schema.json
Normal file
33
plugins/user_packages/manifest-schema.json
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "Image commands plugin manifest",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"plugins": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"user_packages": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"repo": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"type": "string"},
|
||||||
|
"minItems": 1
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"type": "string"},
|
||||||
|
"minItems": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"anyOf": [
|
||||||
|
{"required": ["repo"]},
|
||||||
|
{"required": ["local"]}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["user_packages"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["plugins"]
|
||||||
|
}
|
|
@ -13,8 +13,6 @@ class AddUserPackages(Task):
|
||||||
successors = [CheckPackages]
|
successors = [CheckPackages]
|
||||||
|
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
if 'repo' not in info.manifest.plugins['user_packages']:
|
|
||||||
return
|
|
||||||
for pkg in info.manifest.plugins['user_packages']['repo']:
|
for pkg in info.manifest.plugins['user_packages']['repo']:
|
||||||
info.img_packages[0].add(pkg)
|
info.img_packages[0].add(pkg)
|
||||||
|
|
||||||
|
@ -25,9 +23,6 @@ class AddLocalUserPackages(Task):
|
||||||
predecessors = [MountRoot]
|
predecessors = [MountRoot]
|
||||||
|
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
if 'local' not in info.manifest.plugins['user_packages']:
|
|
||||||
return
|
|
||||||
|
|
||||||
import stat
|
import stat
|
||||||
rwxr_xr_x = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
|
rwxr_xr_x = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
|
||||||
stat.S_IRGRP | stat.S_IXGRP |
|
stat.S_IRGRP | stat.S_IXGRP |
|
||||||
|
|
Loading…
Add table
Reference in a new issue