Skip to content

Commit

Permalink
Default to {} for parameter arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
phobologic committed Mar 17, 2015
1 parent 36a5a4a commit 2ce7f0c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/stacker
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ def get_stack_config(config, stack_list):


class KeyValueAction(argparse.Action):
def __init__(self, option_strings, dest, nargs=None, **kwargs):
def __init__(self, option_strings, dest, default=None, nargs=None,
**kwargs):
if nargs:
raise ValueError("nargs not allowed")
default = default or {}
super(KeyValueAction, self).__init__(option_strings, dest, nargs,
**kwargs)
default=default, **kwargs)

def __call__(self, parser, namespace, values, option_string=None):
if not isinstance(values, Mapping):
Expand Down Expand Up @@ -73,7 +75,7 @@ def parse_args():
"templates.")
parser.add_argument("-p", "--parameter", dest="parameters",
metavar="PARAMETER=VALUE", type=key_value_arg,
action=KeyValueAction,
action=KeyValueAction, default={},
help="Adds parameters from the command line "
"that can be used inside any of the stacks "
"being built. Can be specified more than once.")
Expand Down

0 comments on commit 2ce7f0c

Please sign in to comment.