From 80dcfdc765dad0fb003c9c8527851b3f2a90381c Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 27 Dec 2021 15:48:59 +0100 Subject: [PATCH] correct yamllint --- enedisgateway2mqtt/rootfs/scripts/99-run.sh | 58 +++++++++---------- .../rootfs/scripts/99-run.sh | 58 +++++++++---------- firefly_iii/rootfs/scripts/92-config_yaml.sh | 12 ++-- gazpar2mqtt/rootfs/scripts/92-config_yaml.sh | 12 ++-- .../rootfs/etc/cont-init.d/90-config_yaml.sh | 10 ++-- webtrees/rootfs/scripts/90-config_yaml.sh | 10 ++-- whoogle/rootfs/scripts/90-config_yaml.sh | 10 ++-- zzz_templates/90-config_yaml.sh | 10 ++-- 8 files changed, 90 insertions(+), 90 deletions(-) diff --git a/enedisgateway2mqtt/rootfs/scripts/99-run.sh b/enedisgateway2mqtt/rootfs/scripts/99-run.sh index 2848ac474..5f73018b3 100644 --- a/enedisgateway2mqtt/rootfs/scripts/99-run.sh +++ b/enedisgateway2mqtt/rootfs/scripts/99-run.sh @@ -14,33 +14,33 @@ mkdir -p "$(dirname "${DATABASESOURCE}")" # Check absence of config file if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then - bashio::log.warning "A current config was found in /data, it is backuped to ${CONFIGSOURCE}.bak" - mv /data/config.yaml $CONFIGSOURCE.bak + bashio::log.warning "A current config was found in /data, it is backuped to ${CONFIGSOURCE}.bak" + mv /data/config.yaml $CONFIGSOURCE.bak fi # Check if config file is there, or create one from template if [ -f $CONFIGSOURCE ]; then - # Create symlink if not existing yet - [ ! -L /data/config.yaml ] && ln -sf $CONFIGSOURCE /data - bashio::log.info "Using config file found in $CONFIGSOURCE" - - # Check if yaml is valid - EXIT_CODE=0 - yamllint -d relaxed --no-warnings $CONFIGSOURCE &> ERROR || EXIT_CODE=$? - if [ $EXIT_CODE = 0 ]; then + # Create symlink if not existing yet + [ ! -L /data/config.yaml ] && ln -sf $CONFIGSOURCE /data + bashio::log.info "Using config file found in $CONFIGSOURCE" + + # Check if yaml is valid + EXIT_CODE=0 + yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$? + if [ $EXIT_CODE = 0 ]; then echo "Config file is a valid yaml" - else - cat ERROR - bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above. You can check yaml validity with the online tool yamllint.com" - bashio::exit.nok - fi + else + cat ERROR + bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above. You can check yaml validity with the online tool yamllint.com" + bashio::exit.nok + fi else - # Create symlink for addon to create config - touch ${CONFIGSOURCE} - ln -sf $CONFIGSOURCE /data - rm $CONFIGSOURCE - # Need to restart - bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." + # Create symlink for addon to create config + touch ${CONFIGSOURCE} + ln -sf $CONFIGSOURCE /data + rm $CONFIGSOURCE + # Need to restart + bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." fi # Remove previous link or file @@ -48,14 +48,14 @@ fi # Check if database is here or create symlink if [ -f $DATABASESOURCE ]; then - # Create symlink if not existing yet - ln -sf ${DATABASESOURCE} /data && echo "creating symlink" - bashio::log.info "Using database file found in $DATABASESOURCE" + # Create symlink if not existing yet + ln -sf ${DATABASESOURCE} /data && echo "creating symlink" + bashio::log.info "Using database file found in $DATABASESOURCE" else - # Create symlink for addon to create database - touch ${DATABASESOURCE} - ln -sf $DATABASESOURCE /data - rm $DATABASESOURCE + # Create symlink for addon to create database + touch ${DATABASESOURCE} + ln -sf $DATABASESOURCE /data + rm $DATABASESOURCE fi ############## @@ -71,7 +71,7 @@ if [ $TZ = "test" ]; then echo "secret mode found, launching script in /config/test.sh" cd /config chmod 777 test.sh - ./test.sh + ./test.sh fi python -u /app/main.py || bashio::log.fatal "The app has crashed. Are you sure you entered the correct config options?" diff --git a/enedisgateway2mqtt_dev/rootfs/scripts/99-run.sh b/enedisgateway2mqtt_dev/rootfs/scripts/99-run.sh index 989d9e3e5..42cdefabb 100644 --- a/enedisgateway2mqtt_dev/rootfs/scripts/99-run.sh +++ b/enedisgateway2mqtt_dev/rootfs/scripts/99-run.sh @@ -14,33 +14,33 @@ mkdir -p "$(dirname "${DATABASESOURCE}")" # Check absence of config file if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then - bashio::log.warning "A current config was found in /data, it is backuped to ${CONFIGSOURCE}.bak" - mv /data/config.yaml $CONFIGSOURCE.bak + bashio::log.warning "A current config was found in /data, it is backuped to ${CONFIGSOURCE}.bak" + mv /data/config.yaml $CONFIGSOURCE.bak fi # Check if config file is there, or create one from template if [ -f $CONFIGSOURCE ]; then - # Create symlink if not existing yet - [ ! -L /data/config.yaml ] && ln -sf $CONFIGSOURCE /data - bashio::log.info "Using config file found in $CONFIGSOURCE" - - # Check if yaml is valid - EXIT_CODE=0 - yamllint -d relaxed --no-warnings $CONFIGSOURCE &> ERROR || EXIT_CODE=$? - if [ $EXIT_CODE = 0 ]; then + # Create symlink if not existing yet + [ ! -L /data/config.yaml ] && ln -sf $CONFIGSOURCE /data + bashio::log.info "Using config file found in $CONFIGSOURCE" + + # Check if yaml is valid + EXIT_CODE=0 + yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$? + if [ $EXIT_CODE = 0 ]; then echo "Config file is a valid yaml" - else - cat ERROR - bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above. You can check yaml validity with the online tool yamllint.com" - bashio::exit.nok - fi + else + cat ERROR + bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above. You can check yaml validity with the online tool yamllint.com" + bashio::exit.nok + fi else - # Create symlink for addon to create config - touch ${CONFIGSOURCE} - ln -sf $CONFIGSOURCE /data - rm $CONFIGSOURCE - # Need to restart - bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." + # Create symlink for addon to create config + touch ${CONFIGSOURCE} + ln -sf $CONFIGSOURCE /data + rm $CONFIGSOURCE + # Need to restart + bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." fi # Remove previous link or file @@ -48,14 +48,14 @@ fi # Check if database is here or create symlink if [ -f $DATABASESOURCE ]; then - # Create symlink if not existing yet - ln -sf ${DATABASESOURCE} /data && echo "creating symlink" - bashio::log.info "Using database file found in $DATABASESOURCE" + # Create symlink if not existing yet + ln -sf ${DATABASESOURCE} /data && echo "creating symlink" + bashio::log.info "Using database file found in $DATABASESOURCE" else - # Create symlink for addon to create database - touch ${DATABASESOURCE} - ln -sf $DATABASESOURCE /data - rm $DATABASESOURCE + # Create symlink for addon to create database + touch ${DATABASESOURCE} + ln -sf $DATABASESOURCE /data + rm $DATABASESOURCE fi ############## @@ -70,7 +70,7 @@ if [ $TZ = "test" ]; then echo "secret mode found, launching script in /config/test.sh" cd /config chmod 777 test.sh - ./test.sh + ./test.sh fi python -u /app/main.py || bashio::log.fatal "The app has crashed. Are you sure you entered the correct config options?" diff --git a/firefly_iii/rootfs/scripts/92-config_yaml.sh b/firefly_iii/rootfs/scripts/92-config_yaml.sh index 97a89cbaa..4ce48c496 100644 --- a/firefly_iii/rootfs/scripts/92-config_yaml.sh +++ b/firefly_iii/rootfs/scripts/92-config_yaml.sh @@ -30,7 +30,7 @@ fi # Check if yaml is valid EXIT_CODE=0 -yamllint -d relaxed --no-warnings $CONFIGSOURCE &>ERROR || EXIT_CODE=$? +yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$? if [ $EXIT_CODE = 0 ]; then echo "Config file is a valid yaml" else @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; @@ -86,7 +86,7 @@ while IFS= read -r line; do sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true sed -i "1a export $line" /scripts/*run* 2>/dev/null || true # Show in log - if ! bashio::config.false "verbose";then bashio::log.blue "$line"; fi + if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi else bashio::exit.nok "$line does not follow the correct structure. Please check your yaml file." fi diff --git a/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh b/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh index 97a89cbaa..4ce48c496 100644 --- a/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh +++ b/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh @@ -30,7 +30,7 @@ fi # Check if yaml is valid EXIT_CODE=0 -yamllint -d relaxed --no-warnings $CONFIGSOURCE &>ERROR || EXIT_CODE=$? +yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$? if [ $EXIT_CODE = 0 ]; then echo "Config file is a valid yaml" else @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; @@ -86,7 +86,7 @@ while IFS= read -r line; do sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true sed -i "1a export $line" /scripts/*run* 2>/dev/null || true # Show in log - if ! bashio::config.false "verbose";then bashio::log.blue "$line"; fi + if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi else bashio::exit.nok "$line does not follow the correct structure. Please check your yaml file." fi diff --git a/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh b/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh index 0863cb6e5..4ce48c496 100644 --- a/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh +++ b/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh @@ -30,7 +30,7 @@ fi # Check if yaml is valid EXIT_CODE=0 -yamllint -d relaxed --no-warnings $CONFIGSOURCE &>ERROR || EXIT_CODE=$? +yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$? if [ $EXIT_CODE = 0 ]; then echo "Config file is a valid yaml" else @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; diff --git a/webtrees/rootfs/scripts/90-config_yaml.sh b/webtrees/rootfs/scripts/90-config_yaml.sh index 0863cb6e5..4ce48c496 100644 --- a/webtrees/rootfs/scripts/90-config_yaml.sh +++ b/webtrees/rootfs/scripts/90-config_yaml.sh @@ -30,7 +30,7 @@ fi # Check if yaml is valid EXIT_CODE=0 -yamllint -d relaxed --no-warnings $CONFIGSOURCE &>ERROR || EXIT_CODE=$? +yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$? if [ $EXIT_CODE = 0 ]; then echo "Config file is a valid yaml" else @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; diff --git a/whoogle/rootfs/scripts/90-config_yaml.sh b/whoogle/rootfs/scripts/90-config_yaml.sh index 0863cb6e5..4ce48c496 100644 --- a/whoogle/rootfs/scripts/90-config_yaml.sh +++ b/whoogle/rootfs/scripts/90-config_yaml.sh @@ -30,7 +30,7 @@ fi # Check if yaml is valid EXIT_CODE=0 -yamllint -d relaxed --no-warnings $CONFIGSOURCE &>ERROR || EXIT_CODE=$? +yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$? if [ $EXIT_CODE = 0 ]; then echo "Config file is a valid yaml" else @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; diff --git a/zzz_templates/90-config_yaml.sh b/zzz_templates/90-config_yaml.sh index 0863cb6e5..4ce48c496 100644 --- a/zzz_templates/90-config_yaml.sh +++ b/zzz_templates/90-config_yaml.sh @@ -30,7 +30,7 @@ fi # Check if yaml is valid EXIT_CODE=0 -yamllint -d relaxed --no-warnings $CONFIGSOURCE &>ERROR || EXIT_CODE=$? +yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$? if [ $EXIT_CODE = 0 ]; then echo "Config file is a valid yaml" else @@ -45,10 +45,10 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2;