nir0s / python-packer Goto Github PK
View Code? Open in Web Editor NEWA Packer interface for Python
License: Apache License 2.0
A Packer interface for Python
License: Apache License 2.0
I’m considering replicating my bash build scripts in Python. This would be useful. Happy to contribute, but I’d roll my own if you aren’t going to maintain...
After a clean pip install of python-packer (which is pretty neat by the by), I noticed that validating json would fail when using a var-file. Packer is actually looking for -var-file, rather than -vars-file.
[GCC 4.9.2 20150212 (Red Hat 4.9.2-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Python shell history and tab completion are enabled.
import packer
packerfile = '/home/prata/code/packer/templates/webserver.json'
exc = []
vars_file = '/home/prata/code/packer/environment/kuei-jin.json'
packer_exec_path = '/opt/packer/packer'
p = packer.Pack(packerfile, exc=exc, vars_file=vars_file, exec_path=packer_exec_path)
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'Pack'
p = packer.Packer(packerfile, exc=exc, vars_file=vars_file, exec_path=packer_exec_path)
p.validate(syntax_only=False)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/packer/init.py", line 124, in validate
return command()
File "/usr/lib/python2.7/site-packages/sh.py", line 1021, in call
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/usr/lib/python2.7/site-packages/sh.py", line 486, in init
self.wait()
File "/usr/lib/python2.7/site-packages/sh.py", line 500, in wait
self.handle_command_exit_code(exit_code)
File "/usr/lib/python2.7/site-packages/sh.py", line 516, in handle_command_exit_code
raise exc(self.ran, self.process.stdout, self.process.stderr)
sh.ErrorReturnCode_1:
RAN: '/opt/packer/packer validate -vars-file=/home/prata/code/packer/environment/kuei-jin.json /home/prata/code/packer/templates/webserver.json'
Options:
-syntax-only Only check syntax. Do not verify config of the template.
-except=foo,bar,baz Validate all builds other than these
-only=foo,bar,baz Validate only these builds
-var 'key=value' Variable for templates, can be used multiple times.
-var-file=path JSON file containing user variables.
I removed the Usage info and just copied the Options section from the error. Below is my version of packer being used.
[prata@kusanagi packer]$ /opt/packer/packer version
Packer v0.7.5
Your version of Packer is out of date! The latest version
is 0.8.2. You can update by downloading from www.packer.io
[prata@kusanagi packer]$
Would you like me to submit a pull request for this? It's a pretty simple change. Thanks!
I think the installer class should be removed. It is too intrusive to have it there.
Anyone disagrees?
When I run a packer build of an AMI using this module, the command starts and runs......... and runs........ then just spits back my prompt. Is it done? Did it build? No clue... 😢
I've tried both Debug set to True & False p.build(parallel=True, debug=False, force=False)
& p.build(parallel=True, debug=True, force=False)
I would like to have it output the same stdout that the native Packer outputs.
Hi, this hasn't been alive for a while, but wondering if you would be open for new maintainers. It would be great to merge the current pull requests, add typing and a few other things. Thanks!
Currently, there's only one dependency for packer - sh
. I don't see a reason to keep that dependency as it can be easily replaced with subprocess
.
It would be great if the "-on-error=[cleanup|abort|ask]" was supported.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.