My apologies, I included my manual testing as a short sentence near the end 
of my initial post and it is easy to miss. I've been working with this as 
the norm, created this post during one of my runs of "packer build" and 
kept going.

Output from ovftool isn't getting captured in the log or in the stdout of 
"packer build", forcing me to manually run the command to get useful 
debugging info to modify my packer template file.

For example, I took my template, changed my "esxi_host" value in the 
vsphere post-processor to something invalid. If I run the ovftool command 
manually, I still get "exit status 1" but I do not get the full error.

Manual run:
Error: Locator does not refer to an object: 
vi://packer%40vsphere.local@vcenter:443/Datacenter/host/Cluster/?dns=incorrect-esxi-host-dns

packer debug log gives me:

2018/10/23 11:56:32 [INFO] (telemetry) ending vsphere
2018/10/23 11:56:32 Deleting original artifact for build 'vmware-iso'
2018/10/23 11:56:32 ui error: ESC[1;31mBuild 'vmware-iso' errored: 1 
error(s) occurred:

* Post-processor failed: Error uploading virtual machine: exit status 1

ESC[0m
2018/10/23 11:56:32 Builds completed. Waiting on interrupt barrier...
2018/10/23 11:56:32 machine readable: error-count []string{"1"}
2018/10/23 11:56:32 ui error:
==> Some builds didn't complete successfully and had errors:
2018/10/23 11:56:32 machine readable: vmware-iso,error []string{"1 error(s) 
occurred:\n\n* Post-processor failed: Error uploading virtual machine: exit 
status 1\n\n"}
2018/10/23 11:56:32 ui error: --> vmware-iso: 1 error(s) occurred:

* Post-processor failed: Error uploading virtual machine: exit status 1

2018/10/23 11:56:32 ui:
==> Builds finished but no artifacts were created.

Where does "Locator does not refer to an object" go? Additionally, I'm at 
the point now where a manual run of ovftool with the same command will 
succeed while packer is reporting the "exit status 1" failure.

It looks like I've got the following issues. I think 2 is either an error 
or misunderstanding on my part, it seems like 3 and 4 are bugs. I can open 
issues but I wanted to make sure I wasn't missing something

1. -on-error= behaviour is not clear (issue created by Rickard, thanks!)
2. "keep_input_artifact: true" in a post-processor does not work if the 
post-processor fails.
3. packer swallows legitimate errors from ovftool requiring a manual run 
with a copy of the artifacts from previous post-processor or build steps 
grabbed during pauses using -debug switch
4. vsphere post-processor is reporting a failure with no specific error 
from ovftool. Manual runs with the identical command work.

Thanks for all your help so far.

On Tuesday, October 23, 2018 at 10:49:22 AM UTC-6, Rickard von Essen wrote:
>
> Unfortunately the output from the ovftool command is the empty line after 
> "exit status 1"
>
> * Post-processor failed: Error uploading virtual machine: exit status 1
>
>  [0m
>
> -on-error doesn't affect post-provisioners, I filed 
> https://github.com/hashicorp/packer/issues/6901to fix or clarify this.
>
> I would advice that you remove the post-processor and run a build so you 
> get the artifact and then try to run:
>
> ovftool --acceptAllEulas --name=centos7-tmpl-33b99e6 --datastore=datastore 
> --diskMode=thick --network="Network Name" 
> centos7-tmpl-33b99e6/centos7-tmpl-33b99e6.vmx 
> vi://<username>:<password>@vcenter-host/datacenter/host/cluster/?dns=esxi-host
>
> Manually to troubleshoot (change the user password to the correct, 
> unmasked values).
>
> On Tue, Oct 23, 2018 at 5:47 PM Jackson <[email protected] 
> <javascript:>> wrote:
>
>> I've attached the log file. The only changes I made were to anonymize 
>> anything site specific. Thank you for taking the time to look.
>>
>> On Monday, October 22, 2018 at 11:56:03 PM UTC-6, Rickard von Essen wrote:
>>>
>>> Could you attach the full PACKER_LOG ? 
>>>
>>> On Mon, Oct 22, 2018 at 10:35 PM <[email protected]> 
>>> wrote:
>>>
>>>> Running Packer version 1.3.1
>>>>
>>>> I have a template that uses the vmware-iso builder to give me a VM 
>>>> built on a local copy of VMware Fusion. This works great.
>>>>
>>>> I've tried to add in the vsphere post-processor but I'm running into an 
>>>> error at that step of the process. I wasn't getting any info from the 
>>>> normal output so I enabled PACKER_DEBUG=1. This also isn't giving me any 
>>>> output to determine the cause of the error (relevant portion included 
>>>> below):
>>>>
>>>> 2018/10/22 14:21:32 [INFO] (telemetry) Starting post-processor vsphere
>>>> 2018/10/22 14:21:32 ui: ESC[0;32m    vmware-iso (vsphere): Uploading 
>>>> centos7-tmpl-33b99e6/centos7-tmpl-33b99e6.vmx to vSphereESC[0m
>>>> 2018/10/22 14:21:32 packer: 2018/10/22 14:21:32 Starting ovftool with 
>>>> parameters: --acceptAllEulas --name=centos7-tmpl-33b99e6 
>>>> --datastore=datastore --diskMode=thick --network="Network Name" 
>>>> centos7-tmpl-33b99e6/centos7-tmpl-33b99e6.vmx 
>>>> vi://<username>:<password>@vcenter-host/datacenter/host/cluster/?dns=esxi-host
>>>> 2018/10/22 14:21:32 [INFO] (telemetry) ending vsphere
>>>> 2018/10/22 14:21:32 Deleting original artifact for build 'vmware-iso'
>>>> 2018/10/22 14:21:32 ui error: ESC[1;31mBuild 'vmware-iso' errored: 1 
>>>> error(s) occurred:
>>>>
>>>> * Post-processor failed: Error uploading virtual machine: exit status 1
>>>>
>>>> ESC[0m
>>>> 2018/10/22 14:21:32 Builds completed. Waiting on interrupt barrier...
>>>> 2018/10/22 14:21:32 machine readable: error-count []string{"1"}
>>>> 2018/10/22 14:21:32 ui error:
>>>> ==> Some builds didn't complete successfully and had errors:
>>>> 2018/10/22 14:21:32 machine readable: vmware-iso,error []string{"1 
>>>> error(s) occurred:\n\n* Post-processor failed: Error uploading virtual 
>>>> machine: exit status 1\n\n"}
>>>> 2018/10/22 14:21:32 ui error: --> vmware-iso: 1 error(s) occurred:
>>>>
>>>> * Post-processor failed: Error uploading virtual machine: exit status 1
>>>>
>>>> Because the build fails, Packer removes all the intermediate artifacts 
>>>> so I'm unable to perform a manual test with the output from a failed 
>>>> build. 
>>>> I've tried adding "keep_input_artifact" as true to my post-processor but 
>>>> this has no effect. The documentation 
>>>> <https://www.packer.io/docs/templates/post-processors.html> implies 
>>>> that this is only checked after the successful execution of a 
>>>> post-processor. I've also tried -on-error=ask or -on-error=abort but 
>>>> neither of these ask me or abort when the post-processor runs into an 
>>>> error 
>>>> and keeps my VM artifact.
>>>>
>>>> So far the only thing that has worked has been to run "packer build 
>>>> -debug" and babysit the process as it runs, moving through each step. Once 
>>>> it finishes the builder, but before it runs my post-processor, manually 
>>>> make a separate copy of the artifact and continue on to let the build 
>>>> fail. 
>>>> A manual test will let me see the ovftool error.
>>>>
>>>> If anyone has any help for me to solve any of the above issues or other 
>>>> directions I might not have considered please let me know. I'll provide 
>>>> more info as necessary 
>>>>
>>>> 1. Lack of ovftool output
>>>> 2. Unable to retain output from vmware-iso builder when post-processor 
>>>> fails
>>>>
>>>> Thanks!
>>>>
>>>> -- 
>>>> This mailing list is governed under the HashiCorp Community Guidelines 
>>>> - https://www.hashicorp.com/community-guidelines.html. Behavior in 
>>>> violation of those guidelines may result in your removal from this mailing 
>>>> list.
>>>>  
>>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>>> IRC: #packer-tool on Freenode
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Packer" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/packer-tool/a6b1f4a9-61c3-48e8-b4db-5ad12b7a0194%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/packer-tool/a6b1f4a9-61c3-48e8-b4db-5ad12b7a0194%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>> This mailing list is governed under the HashiCorp Community Guidelines - 
>> https://www.hashicorp.com/community-guidelines.html. Behavior in 
>> violation of those guidelines may result in your removal from this mailing 
>> list.
>>  
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/a7cafd2e-c816-490a-a406-5a6560765662%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/packer-tool/a7cafd2e-c816-490a-a406-5a6560765662%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/778be8ac-9ce7-4fb3-995e-85efbb84462e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to