changeset 632:9dd2f68f243b

chef: Fix the `--config-set` option.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 09 Feb 2016 20:22:27 -0800
parents 01120d172802
children 7b4f0687d9d9
files piecrust/main.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/main.py	Mon Feb 08 23:34:45 2016 -0800
+++ b/piecrust/main.py	Tue Feb 09 20:22:27 2016 -0800
@@ -89,7 +89,9 @@
             help="The configuration variant to use for this command.")
     parser.add_argument(
             '--config-set',
-            nargs='*',
+            nargs=2,
+            metavar=('NAME', 'VALUE'),
+            action='append',
             dest='config_values',
             help="Sets a specific site configuration setting.")
     parser.add_argument(
@@ -208,8 +210,10 @@
     cache_key = 'default'
 
     # Handle custom configurations.
-    if pre_args.config_variant is not None and not root:
-        raise SiteNotFoundError("Can't apply any variant.")
+    if (pre_args.config_variant or pre_args.config_values) and not root:
+        raise SiteNotFoundError(
+                "Can't apply any configuration variant or value overrides, "
+                "there is no website here.")
     apply_variant_and_values(app, pre_args.config_variant,
                              pre_args.config_values)