From 4708a16bdff689b376f13feffbfdba1ddec27e51 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 9 Apr 2020 08:12:40 +0200 Subject: [PATCH 1/3] add quote for response --- provisioning_example.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/provisioning_example.sh b/provisioning_example.sh index 17d08d7..6b76867 100755 --- a/provisioning_example.sh +++ b/provisioning_example.sh @@ -31,7 +31,7 @@ verif() { for V in creole.reseau.unbound_route_address creole.reseau.unbound_domain_name creole.serveur_dns.unbound_local_zones creole.reseau.unbound_ip_address_cidr; do i=$((i+1)) R=$(cucchiaiata-cli setting.session.$1.get -s $S -n $V | jq -Mcr .content[]) - [ $R = "${argv[i]}" ] + [ "$R" = "${argv[i]}" ] done } @@ -113,7 +113,7 @@ cucchiaiata-cli setting.template.generate -s dns.cadoles.com cucchiaiata-cli setting.servermodel.dependency.add -m aca -a openssh -o cadoles -e last S=$(cucchiaiata-cli setting.session.server.start -s dns.cadoles.com | jq -r .session_id) R=$(cucchiaiata-cli setting.session.server.get -s $S -n creole.serveur_ssh.ssh_allow_networks | jq -Mcr .content[]) -[ $R = "[]" ] +[ "$R" = "[]" ] cucchiaiata-cli setting.session.server.stop -s $S S=$(cucchiaiata-cli setting.session.servermodel.start -m aca -e last| jq -r .session_id) @@ -122,7 +122,7 @@ cucchiaiata-cli setting.session.servermodel.stop -s $S -a S=$(cucchiaiata-cli setting.session.server.start -s dns.cadoles.com | jq -r .session_id) R=$(cucchiaiata-cli setting.session.server.get -s $S -n creole.serveur_ssh.ssh_allow_networks | jq -Mcr .content[]) -[ $R = '["admin.cadoles.com"]' ] +[ "$R" = '["admin.cadoles.com"]' ] cucchiaiata-cli setting.session.server.stop -s $S # Regenerate configuration From 932fbc18e21e4eeddd60e08dfe0f371f05012062 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 9 Apr 2020 08:31:54 +0200 Subject: [PATCH 2/3] debug in config file could be 'false'w --- src/cucchiaiata/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cucchiaiata/config.py b/src/cucchiaiata/config.py index e440306..26db22c 100644 --- a/src/cucchiaiata/config.py +++ b/src/cucchiaiata/config.py @@ -26,10 +26,10 @@ version: {version}""" config = load(stream, Loader=SafeLoader) except YAMLError as err: raise Exception(_('Error when creating the config file {}').format(err)) - + self.url = config['url'] self.version = config['version'] - self.debug = 'debug' in config + self.debug = config.get('debug', False) self.remote_url = 'http://{}/api/{}'.format(self.url, self.version) self.token_file = join(expanduser("~"), '.zephir-client.jwt.token') self.indent = config.get('indent', 2) From 58370148bcc4136a8cb082a48526aa6f57c1e3bc Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 9 Apr 2020 08:34:08 +0200 Subject: [PATCH 3/3] manage no argument set to script/cucchiaiata-cli commandline tool --- script/cucchiaiata-cli | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/cucchiaiata-cli b/script/cucchiaiata-cli index 39be057..4f24fdd 100755 --- a/script/cucchiaiata-cli +++ b/script/cucchiaiata-cli @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/python3 """Zephir-cmd-input script """ from sys import exit, argv @@ -10,8 +10,8 @@ from cucchiaiata.i18n import _ def main(): try: - if argv[1] in ['setting.session.server.configure', - 'setting.session.servermodel.configure']: + if len(argv) > 2 and argv[1] in ['setting.session.server.configure', + 'setting.session.servermodel.configure']: Configuration().get() else: parser = Parser()