mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00
Sed the config file for cloud-init.
This commit is contained in:
parent
e04541587a
commit
56e13fbe56
4 changed files with 89 additions and 0 deletions
11
plugins/sed/__init__.py
Normal file
11
plugins/sed/__init__.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
def tasks(tasklist, manifest):
|
||||||
|
import tasks
|
||||||
|
tasklist.add(tasks.DoSeds())
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
28
plugins/sed/manifest-schema.json
Normal file
28
plugins/sed/manifest-schema.json
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "Backports setup and package install",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"plugins": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"sed": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"file": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"find": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["sed"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["plugins"]
|
||||||
|
}
|
19
plugins/sed/tasks.py
Normal file
19
plugins/sed/tasks.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
from base import Task
|
||||||
|
from common import phases
|
||||||
|
from common.tasks.apt import AptUpgrade
|
||||||
|
from common.tools import sed_i
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class DoSeds(Task):
|
||||||
|
description = 'Sedding files'
|
||||||
|
phase = phases.system_modification
|
||||||
|
after = [AptUpgrade]
|
||||||
|
def run(self, info):
|
||||||
|
|
||||||
|
chroot_path = os.path.join(info.root, info.manifest.plugins['sed']['file'])
|
||||||
|
print chroot_path
|
||||||
|
print info.manifest.plugins['sed']['file']
|
||||||
|
print info.manifest.plugins['sed']['find']
|
||||||
|
print info.manifest.plugins['sed']['replace']
|
||||||
|
sed_i(chroot_path, info.manifest.plugins['sed']['find'], info.manifest.plugins['sed']['replace'])
|
31
plugins/sed/temp
Normal file
31
plugins/sed/temp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "Backports setup and package install",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"plugins": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"sed": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"file": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"find": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["sed"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["plugins"]
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue