comparison piecrust/main.py @ 632:9dd2f68f243b

chef: Fix the `--config-set` option.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 09 Feb 2016 20:22:27 -0800
parents 2edaefcb82cd
children 3ceeca7bb71c
comparison
equal deleted inserted replaced
631:01120d172802 632:9dd2f68f243b
87 '--config', 87 '--config',
88 dest='config_variant', 88 dest='config_variant',
89 help="The configuration variant to use for this command.") 89 help="The configuration variant to use for this command.")
90 parser.add_argument( 90 parser.add_argument(
91 '--config-set', 91 '--config-set',
92 nargs='*', 92 nargs=2,
93 metavar=('NAME', 'VALUE'),
94 action='append',
93 dest='config_values', 95 dest='config_values',
94 help="Sets a specific site configuration setting.") 96 help="Sets a specific site configuration setting.")
95 parser.add_argument( 97 parser.add_argument(
96 '--debug', 98 '--debug',
97 help="Show debug information.", action='store_true') 99 help="Show debug information.", action='store_true')
206 208
207 # Build a hash for a custom cache directory. 209 # Build a hash for a custom cache directory.
208 cache_key = 'default' 210 cache_key = 'default'
209 211
210 # Handle custom configurations. 212 # Handle custom configurations.
211 if pre_args.config_variant is not None and not root: 213 if (pre_args.config_variant or pre_args.config_values) and not root:
212 raise SiteNotFoundError("Can't apply any variant.") 214 raise SiteNotFoundError(
215 "Can't apply any configuration variant or value overrides, "
216 "there is no website here.")
213 apply_variant_and_values(app, pre_args.config_variant, 217 apply_variant_and_values(app, pre_args.config_variant,
214 pre_args.config_values) 218 pre_args.config_values)
215 219
216 # Adjust the cache key. 220 # Adjust the cache key.
217 if pre_args.config_variant is not None: 221 if pre_args.config_variant is not None: