diff --git a/packer.py b/packer.py index 1714d0c..b49d109 100644 --- a/packer.py +++ b/packer.py @@ -50,20 +50,26 @@ def init(self, upgrade=False): return self.packer_cmd() - def build(self, parallel=True, debug=False, force=False, machine_readable=False): + def build(self, parallel=True, debug=False, force=False, machine_readable=False, color=False, on_error="cleanup", timestamp_ui=False): """Executes a `packer build` :param bool parallel: Run builders in parallel :param bool debug: Run in debug mode :param bool force: Force artifact output even if exists :param bool machine_readable: Make output machine-readable + :param bool color: Enable color output + :param str on_error: If the build fails do: clean up (default), abort, ask, or run-cleanup-provisioner + :param bool timestamp_ui: Enable prefixing of each ui output with an RFC3339 timestamp """ self.packer_cmd = self.packer.build - self._add_opt('-parallel-builds={}'.format(os.cpu_count()) if parallel else 1) + self._add_opt('-parallel-builds={}'.format(os.cpu_count()) if parallel else None) self._add_opt('-debug' if debug else None) self._add_opt('-force' if force else None) self._add_opt('-machine-readable' if machine_readable else None) + self._add_opt('-color={}'.format(True if color else False)) + self._add_opt('-on-error={}'.format(on_error)) + self._add_opt('-timestamp-ui' if timestamp_ui else None) self._append_base_arguments() self._add_opt(self.template) diff --git a/setup.py b/setup.py index 0185c2c..15405b4 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(*parts): setup( name='python-packer', - version='1.0.1', + version='1.0.2', url='https://github.com/abhi1693/python-packer', author='abhi1693', author_email='desk.abhimanyu@gmail.com',