Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ class Packer():
"""Packer interface using the `sh` module (http://amoffat.github.io/sh/)
"""
def __init__(self, packerfile, exc=None, only=None, vars=None,
vars_file=None, exec_path=DEFAULT_PACKER_PATH):
var_file=None, exec_path=DEFAULT_PACKER_PATH):
"""
:param string packerfile: Path to Packer template file
:param list exc: List of builders to exclude
:param list only: List of builders to include
:param dict vars: Key Value pairs of template variables
:param string vars_file: Path to variables file
:param string var_file: Path to variables file
:param string exec_path: Path to Packer executable
"""
self.packerfile = self._validate_argtype(packerfile, str)
self.vars_file = vars_file
self.var_file = var_file
if not os.path.isfile(self.packerfile):
raise OSError('packerfile not found at path: {0}'.format(
self.packerfile))
Expand Down Expand Up @@ -157,7 +157,7 @@ def _validate_argtype(self, arg, argtype):
def _append_base_arguments(self):
"""Appends base arguments to packer commands.

-except, -only, -var and -vars-file are appeneded to almost
-except, -only, -var and -var-file are appeneded to almost
all subcommands in packer. As such this can be called to add
these flags to the subcommand.
"""
Expand All @@ -169,8 +169,8 @@ def _append_base_arguments(self):
self._add_opt('-only={0}'.format(self._joinc(self.only)))
for var, value in self.vars.items():
self._add_opt("-var '{0}={1}'".format(var, value))
if self.vars_file:
self._add_opt('-vars-file={0}'.format(self.vars_file))
if self.var_file:
self._add_opt('-var-file={0}'.format(self.var_file))

def _joinc(self, lst):
"""Returns a comma delimited string from a list"""
Expand Down