def creator(_, config):
        """Creator function for creating an instance of a Packer image script."""
        packer_script = render(config.script, model=config.model, env=config.env,
                               variables=config.variables, item=config.item)
        filename = "packer.dry.run.see.comment"

        if not config.dry_run:
            # writing Packer file (JSON)
            filename = write_temporary_file(packer_script, 'packer-', '.json')
            packer_script = ''

        # rendering the Bash script for generating the Packer image
        template_file = os.path.join(os.path.dirname(__file__), 'templates/packer-image.sh.j2')

        with open(template_file) as handle:
            template = handle.read()
            config.script = render(template, debug=config.debug,
                                   packer_content=packer_script,
                                   packer_filename=filename)

        return Packer(config)
def creator ( _ , config ) : packer_script = render ( config . script , model = config . model , env = config . env , variables = config . variables , item = config . item ) filename = "packer.dry.run.see.comment" if not config . dry_run : filename = write_temporary_file ( packer_script , 'packer-' , '.json' ) packer_script = '' template_file = os . path . join ( os . path . dirname ( __file__ ) , 'templates/packer-image.sh.j2' ) with open ( template_file ) as handle : template = handle . read ( ) config . script = render ( template , debug = config . debug , packer_content = packer_script , packer_filename = filename ) return Packer ( config )
Creator function for creating an instance of a Packer image script.