def test_template_error(self): """ Template errors result in the process exiting and an error message printed to stderr. Packer prints machine-readable output to stderr and ``publish-installer-images`` echos those lines to its stderr as well as parsing the output. """ sys_module = FakeSysModule() self.addCleanup(lambda: self.addDetail( name="stderr", content_object=text_content(sys_module.stderr.getvalue()))) configuration_path = self.make_temporary_file(content='') d = async_perform( dispatcher=RealPerformers(sys_module=sys_module, ).dispatcher(), effect=Effect( intent=PackerBuild(configuration_path=configuration_path, ))) d = self.assertFailure(d, ProcessTerminated) def check_error(exception): self.assertEqual(1, exception.exitCode) self.assertIn("Failed to parse template", sys_module.stderr.getvalue()) return d.addCallback(check_error)
def test_template_error(self): """ Template errors result in the process exiting and an error message printed to stderr. Packer prints machine-readable output to stderr and ``publish-installer-images`` echos those lines to its stderr as well as parsing the output. """ sys_module = FakeSysModule() self.addCleanup( lambda: self.addDetail(name="stderr", content_object=text_content(sys_module.stderr.getvalue())) ) configuration_path = self.make_temporary_file(content="") d = async_perform( dispatcher=RealPerformers(sys_module=sys_module).dispatcher(), effect=Effect(intent=PackerBuild(configuration_path=configuration_path)), ) d = self.assertFailure(d, ProcessTerminated) def check_error(exception): self.assertEqual(1, exception.exitCode) self.assertIn("Failed to parse template", sys_module.stderr.getvalue()) return d.addCallback(check_error)
def publish_installer_images_main(reactor, args, base_path, top_level): options = PublishInstallerImagesOptions() try: options.parseOptions(args) except UsageError as e: sys.stderr.write("Usage Error: %s: %s\n" % (base_path.basename(), e)) raise SystemExit(1) return async_perform( dispatcher=RealPerformers(reactor=reactor).dispatcher(), effect=publish_installer_images_effects(options=options))
def publish_installer_images_main(reactor, args, base_path, top_level): options = PublishInstallerImagesOptions() try: options.parseOptions(args) except UsageError as e: sys.stderr.write( "Usage Error: %s: %s\n" % ( base_path.basename(), e ) ) raise SystemExit(1) return async_perform( dispatcher=RealPerformers(reactor=reactor).dispatcher(), effect=publish_installer_images_effects(options=options) )