added production commands and final config structure

This commit is contained in:
Alexander Werner 2018-11-22 20:47:36 +01:00
parent b56e159aa8
commit ff12af70d8
5 changed files with 67 additions and 10 deletions

View File

@ -1,3 +1,5 @@
import uuid
import click
from click_didyoumean import DYMGroup
import click_log
@ -13,6 +15,19 @@ click_log.basic_config(root_logger)
def cli():
pass
@cli.command()
def get_gpio():
"""
Get the current status of all Tables.
"""
pass
@cli.command()
def get_uuid():
"""
Get the UUID of the Client. This is need to add a new client to the carom server installation.
"""
click.echo(uuid.uuid5(uuid.NAMESPACE_DNS, str(uuid.getnode())))
@cli.command()
def run():
@ -21,7 +36,6 @@ def run():
"""
pass
@cli.command()
def check_config():
"""

View File

@ -1,2 +1,14 @@
[test]
foo = bar
[connection]
endpoint = https://carom.einsle.de/{0}
token =
[mapping]
20 = 1
16 = 2
12 = 3
7 = 4
8 = 5
25 = 6
24 = 7
18 = 8
[logging]
file = /var/log/carom-client.log

View File

@ -1,7 +1,7 @@
import configparser
import logging
from voluptuous import Schema, Error
from voluptuous import Schema, Error, Range, All, Coerce
from voluptuous.humanize import validate_with_humanized_errors
from carom.const import CONFIG_FILES, DEFAULT_CONFIG
@ -14,9 +14,16 @@ _parser.read(CONFIG_FILES)
# Convert the ConfigParser object to a real dict now:
_parser_dict = {s: dict(_parser.items(s)) for s in _parser.sections()}
_schema = Schema({
'test': {
'foo': str,
'connection': {
'endpoint': str,
'token': str,
},
'mapping': {
All(Coerce(int), Range(0, 28)): All(Coerce(int), Range(1, 8)),
},
'logging': {
'file': str
}
})
try:

View File

@ -1,8 +1,6 @@
from pkg_resources import resource_string
AVAILABLE_PINS = range(0, 28)
"""Pins available for Configuration"""
DEFAULT_CONFIG = resource_string(__name__, 'client.ini').decode()
"""Default configfile, that is used as a Fallback if no other configuration exists."""
CONFIG_FILES = ('~/.config/carom/client.ini', '/etc/carom/client.ini')
CONFIG_FILES = ('/boot/carom-client.conf', )
"""Order of resolution of Config Files. Files are tried in order, first one found is used."""

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "CAROM-CLIENT" "1" "05.11.2018" "" "Carom Client"
.TH "CAROM-CLIENT" "1" "22.11.2018" "" "Carom Client"
.SH NAME
carom-client \- Carom Client Documentation
.
@ -58,6 +58,32 @@ carom\-client check\-config [OPTIONS]
.fi
.UNINDENT
.UNINDENT
.SH GET-GPIO
.sp
Get the current status of all Tables.
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
carom\-client get\-gpio [OPTIONS]
.ft P
.fi
.UNINDENT
.UNINDENT
.SH GET-UUID
.sp
Get the UUID of the Client. This is need to add a new client to the carom server installation.
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
carom\-client get\-uuid [OPTIONS]
.ft P
.fi
.UNINDENT
.UNINDENT
.SH RUN
.sp
This command runs the carom\-client daemon process.