summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-01-19 12:11:42 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-01-19 12:11:42 +0000
commitaab70777f26e52216f64024612baaed58b394653 (patch)
tree4807eefa638392bcf3514fcfca5caa7c1c03abe9
parent3efe5baa9e56db0c8ecdcdef623c4604abbf0397 (diff)
downloadgitano-aab70777f26e52216f64024612baaed58b394653.tar.gz
Ensure that config show will fail if none of the keys supplied are found
-rw-r--r--lib/gitano/command.lua9
-rw-r--r--testing/02-commands-config.yarn13
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/gitano/command.lua b/lib/gitano/command.lua
index e7a61cb..4070338 100644
--- a/lib/gitano/command.lua
+++ b/lib/gitano/command.lua
@@ -537,6 +537,15 @@ local function builtin_config_run(conf, repo, cmdline, env)
end
log.stdout(key .. ": " .. value)
end
+ if #slist == 0 then
+ local keys = {}
+ for i = 4, #cmdline do
+ keys[#keys+1] = "'" .. cmdline[i] .. "'"
+ end
+ keys = table.concat(keys, ", ")
+ log.error("Configuration keys not found: " .. keys)
+ return "exit", 1
+ end
elseif cmdline[3] == "set" then
local key, value = cmdline[4], cmdline[5]
local vtype, rest = value:match(pattern.CONF_SET_TYPE_PREFIX)
diff --git a/testing/02-commands-config.yarn b/testing/02-commands-config.yarn
index 00b07b8..1af8bc9 100644
--- a/testing/02-commands-config.yarn
+++ b/testing/02-commands-config.yarn
@@ -113,3 +113,16 @@ new items appended...
FINALLY the instance is torn down
FIXME: Now that we have the ability to patch the rules we should add more tests
+
+Unknown config values error out on show
+---------------------------------------
+
+It's essential that the user is told when they've attempted to show a config
+value which simply does not exist.
+
+ SCENARIO Showing non-existant configuration values
+
+ GIVEN a standard instance
+ WHEN testinstance adminkey, expecting failure, runs config gitano-admin show banana
+ THEN stdout is empty
+ AND stderr contains banana