From 3f310220e26eef5c4ef8ef0c05fa331aa0a30b5c Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 12 Jul 2011 11:41:28 +0200 Subject: [PATCH 1/2] sanitize shown column in CLI list --- src/cli/cli_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/cli_helper.rb b/src/cli/cli_helper.rb index 4b3e9b63b1..daa359c665 100644 --- a/src/cli/cli_helper.rb +++ b/src/cli/cli_helper.rb @@ -95,7 +95,6 @@ module CLIHelper require 'yaml' def initialize(conf=nil, ext=nil, &block) - # merge del conf con la table @columns = Hash.new @default_columns = Array.new @@ -205,6 +204,9 @@ module CLIHelper default = config.delete(:default) @default_columns = default unless default.empty? + # Filter show options with available columns + @default_columns &= @columns.keys + @columns.merge!(config) { |key, oldval, newval| oldval.merge(newval) } From 1cb6f97ebdadd53d3884da6601033c787aac40f1 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 12 Jul 2011 12:37:23 +0200 Subject: [PATCH 2/2] port configuration reader for scheduler now more compatible --- share/scripts/one | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/share/scripts/one b/share/scripts/one index 3b26c0e55c..1fde2cd6f0 100755 --- a/share/scripts/one +++ b/share/scripts/one @@ -22,6 +22,7 @@ if [ -z "$ONE_LOCATION" ]; then ONE_CONF=/etc/one/oned.conf ONE_DB=/var/lib/one/one.db ONE_LOG=/var/log/one/oned.log + ONE_CONFIG=/var/lib/one/config ONED=/usr/bin/oned ONE_SCHEDULER=/usr/bin/mm_sched @@ -33,6 +34,7 @@ else ONE_CONF=$ONE_LOCATION/etc/oned.conf ONE_DB=$ONE_LOCATION/var/one.db ONE_LOG=$ONE_LOCATION/var/oned.log + ONE_CONFIG=$ONE_LOCATION/var/config ONED=$ONE_LOCATION/bin/oned ONE_SCHEDULER=$ONE_LOCATION/bin/mm_sched @@ -45,11 +47,10 @@ fi #------------------------------------------------------------------------------ setup() { - PORT=$(sed -n '/^[ \t]*PORT/s/^.*PORT\s*=\s*\([0-9]\+\)\s*.*$/\1/p' \ - $ONE_CONF) + PORT=$(grep '^PORT=' $ONE_CONFIG | sed 's/PORT=//') if [ $? -ne 0 ]; then - echo "Can not find PORT in $ONE_CONF." + echo "Can not find PORT in $ONE_CONFIG." exit 1 fi