blueprint show -S fails for templates without * #106

ekoyle opened this Issue Dec 19, 2011 · 0 comments


None yet
2 participants

ekoyle commented Dec 19, 2011

I'm running the blueprint package from (I have version 3.4.0-1py2.6).

I created a couple of templates and was unable to run blueprint show -S:

root@fwser-pri:~/deleteme# blueprint show -S firewalls
Traceback (most recent call last):
  File "/usr/bin/blueprint-show", line 58, in <module>
    filename = getattr(b, options.generate)(options.relaxed).dumpf()
  File "/usr/lib/python2.6/dist-packages/blueprint/", line 476, in sh
    return, relaxed, server, secret)
  File "/usr/lib/python2.6/dist-packages/blueprint/frontend/", line 186, in sh
  File "/usr/lib/python2.6/dist-packages/blueprint/", line 504, in walk
    walk.walk(self, **kwargs)
  File "/usr/lib/python2.6/dist-packages/blueprint/", line 27, in walk
    walk_files(b, **kwargs)
  File "/usr/lib/python2.6/dist-packages/blueprint/", line 96, in walk_files
    callable(pathname, f)
  File "/usr/lib/python2.6/dist-packages/blueprint/frontend/", line 101, in file
KeyError: 'data'

It looks like the 'data' key is only populated for a file with *.blueprint-template.mustache temlpate when the corresponding * file exists.

One fix would to be to only reference the value if it exists (will work for existing templates):

--- blueprint/frontend/      2011-12-19 09:37:15.000000000 -0700
+++ blueprint/frontend/   2011-12-19 09:55:02.000000000 -0700
@@ -98,7 +98,7 @@
                                ('\t. "$F"',),
-                               (f['data'].rstrip(),),
+                               ('' if not f.has_key('data') else f['data'].rstrip(),),

Another option would be to always populate it for templates (existing templates would need to be recreated, but probably not a big deal since they don't work anyway):

--- /usr/lib/python2.6/dist-packages/blueprint/backend/    2011-12-19 10:00:50.000000000 -0700
+++ /usr/lib/python2.6/dist-packages/blueprint/backend/ 2011-12-19 10:02:11.000000000 -0700
@@ -764,6 +764,8 @@
                     if template:
                         if data:
                             kwargs['data'] = data.decode('utf_8')
+                        else:
+                            kwargs['data'] = ''
                         kwargs['template'] = template.decode('utf_8')
                         kwargs['content'] = content.decode('utf_8')

rcrowley closed this in 3abaf7f Dec 20, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment