diff --git a/fabricio/docker/container.py b/fabricio/docker/container.py index 84f4d75..701369b 100644 --- a/fabricio/docker/container.py +++ b/fabricio/docker/container.py @@ -32,6 +32,7 @@ class Container(BaseService): network = Option(name='net', safe=True) restart = Option() stop_signal = Option(name='stop-signal', safe=True) + ulimit = Option(safe=True) @utils.default_property def info(self): diff --git a/fabricio/utils.py b/fabricio/utils.py index 202ff05..a2e80c6 100644 --- a/fabricio/utils.py +++ b/fabricio/utils.py @@ -47,9 +47,20 @@ def __call__(self, func): class Options(collections.OrderedDict): def make_option(self, option, value=None): - option = '--' + option + option = ''.join(['--', option]) if value is not None: - option += '=' + shlex_quote(six.text_type(value)) + if isinstance(value, str) and option == '--env': + param = value.split('=', 1) + option = ''.join([ + option, '=', shlex_quote(six.text_type(param[0])), '=', + shlex_quote(six.text_type(param[1]))]) + elif isinstance(value, str) and option == '--ulimit': + param = value.split('=', 1) + option = '{} {}={}'.format( + option, shlex_quote(six.text_type(param[0])), + shlex_quote(six.text_type(param[1]))) + else: + option = ''.join([option, '=', shlex_quote(six.text_type(value))]) return option def make_options(self):