Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion on adding Post-Processor Chain #115

Open
hongjoonchew opened this issue Jul 10, 2018 · 0 comments
Open

Suggestion on adding Post-Processor Chain #115

hongjoonchew opened this issue Jul 10, 2018 · 0 comments

Comments

@hongjoonchew
Copy link
Contributor

hongjoonchew commented Jul 10, 2018

packerlicious version

1.2.4

I noticed in post_processor.py:

class PackerPostProcessorChain(BasePackerObject):
    """
    TODO define what a chain is, see https://www.packer.io/docs/post-processors/artifice.html#configuration
    for example
    """

Looking at how post processor chains, it's simply an additional array over the whole process. So instead of inside post_processor.py, how about in template.py, where:

def add_post_processor_chain(self, *args):
        return self._update(self.post_processors, [args])

It makes it easier to add post-processor chains into the template. I'll post a pull request to this change.

Steps to reproduce

>>> from packerlicious import post_processor, Template
>>> test_template = Template()
>>> file_post = post_processor.Checksum()
>>> file_post2 = post_processor.Artifice(files = ['testfile.test'])
>>> test_template.add_post_processor_chain(file_post,file_post2)
>>> print(test_template.to_json())
{
  "post-processors": [
    # Notice the two arrays
    [
      {
        "type": "checksum"
      },
      {
        "files": [
          "testfile.test"
        ],
        "type": "artifice"
      }
    ]
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant