org.osbuild.systemd.unit.create: Support Socket files
This allows you to create basic socket files. Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
parent
ed33869430
commit
657c42bb0d
2 changed files with 86 additions and 3 deletions
|
|
@ -17,6 +17,8 @@ def validate(filename, cfg):
|
|||
raise ValueError(f"Error: {filename} unit requires Service section")
|
||||
if filename.endswith(".mount") and "Mount" not in cfg:
|
||||
raise ValueError(f"Error: {filename} unit requires Mount section")
|
||||
if filename.endswith(".socket") and "Socket" not in cfg:
|
||||
raise ValueError(f"Error: {filename} unit requires Socket section")
|
||||
|
||||
|
||||
def main(tree, options):
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@
|
|||
" - 'Where' - string",
|
||||
" - 'Type' - string",
|
||||
" - 'Options' - string",
|
||||
" - 'Socket' section",
|
||||
" - 'ListenStream' - string",
|
||||
" - 'ListenDatagram' - string",
|
||||
" - 'ListenSequentialPacket' - string",
|
||||
" - 'ListenFifo' - string",
|
||||
" - 'SocketUser' - string",
|
||||
" - 'SocketGroup' - string",
|
||||
" - 'SocketMode' - string",
|
||||
" - 'DirectoryMode' - string",
|
||||
" - 'Accept' - bool",
|
||||
" - 'Service' - string",
|
||||
" - 'RuntimeDirectory' - string",
|
||||
" - 'RemoveOnStop' - bool",
|
||||
" - 'Install' section",
|
||||
" - 'WantedBy' - [string]",
|
||||
" - 'RequiredBy' - [string]"
|
||||
|
|
@ -46,7 +59,7 @@
|
|||
"properties": {
|
||||
"filename": {
|
||||
"type": "string",
|
||||
"pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.(service|mount)$"
|
||||
"pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.(service|mount|socket)$"
|
||||
},
|
||||
"unit-type": {
|
||||
"type": "string",
|
||||
|
|
@ -78,7 +91,19 @@
|
|||
],
|
||||
"not": {
|
||||
"required": [
|
||||
"Mount"
|
||||
"Mount",
|
||||
"Socket"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"Socket"
|
||||
],
|
||||
"not": {
|
||||
"required": [
|
||||
"Mount",
|
||||
"Service"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -88,7 +113,8 @@
|
|||
],
|
||||
"not": {
|
||||
"required": [
|
||||
"Service"
|
||||
"Service",
|
||||
"Socket"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -236,6 +262,61 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Socket": {
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"description": "'Socket' configuration section of a unit file.",
|
||||
"properties": {
|
||||
"Service": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"ListenStream": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"ListenDatagram": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"ListenSequentialPacket": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"ListenFifo": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"SocketUser": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"SocketGroup": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"SocketMode": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"DirectoryMode": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"Accept": {
|
||||
"description": "",
|
||||
"type": "boolean"
|
||||
},
|
||||
"RuntimeDirectory": {
|
||||
"description": "",
|
||||
"type": "string"
|
||||
},
|
||||
"RemoveOnStop": {
|
||||
"description": "",
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Install": {
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue