8000 Suggestion on adding Post-Processor Chain · Issue #115 · mayn/packerlicious · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Suggestion on adding Post-Processor Chain  #115
Open
@hongjoonchew

Description

@hongjoonchew

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"
      }
    ]
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0