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

Using Powershell Provisioner randomly results in failure to find and execute script on remote host #12614

Open
youngturk2 opened this issue Sep 1, 2023 · 0 comments
Labels

Comments

@youngturk2
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Overview of the Issue

I am working on an automation pipeline that will utilize packer to create custom compute images in Oracle Cloud Infrastructure. The packer build uses a variety of powershell provisioner blocks to provision the custom image. For some reason, at seemingly random points while packer is provisioning the image, packer will return an error similar to the one below:

==> oracle-oci.server2019: & : The term 'c:/Windows/Temp/packer-cleanup-64f1b11f-a3a0-8cd0-650a-5c290ac64efd.ps1' is not recognized as the name
2023/09/01 05:39:21 [INFO] 641 bytes written for 'stderr'
2023/09/01 05:39:21 [INFO] RPC client: Communicator ended with: 0
2023/09/01 05:39:21 [INFO] RPC endpoint: Communicator ended with: 0
2023/09/01 05:39:21 packer.exe plugin: [INFO] 0 bytes written for 'stdout'
2023/09/01 05:39:21 packer.exe plugin: [INFO] 641 bytes written for 'stderr'
2023/09/01 05:39:21 packer.exe plugin: [INFO] RPC client: Communicator ended with: 0
==> oracle-oci.server2019: of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
==> oracle-oci.server2019: verify that the path is correct and try again.
==> oracle-oci.server2019: At line:1 char:216
==> oracle-oci.server2019: + ... 74748.ps1; &'c:/Windows/Temp/packer-cleanup-64f1b11f-a3a0-8cd0-650a-5 ...
==> oracle-oci.server2019: +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> oracle-oci.server2019:     + CategoryInfo          : ObjectNotFound: (c:/Windows/Temp...c290ac64efd.ps1:String) [], CommandNotFoundException
==> oracle-oci.server2019:     + FullyQualifiedErrorId : CommandNotFoundException
==> oracle-oci.server2019:

The above example that I provided appears to be associated with the cleanup script that packer uploads to and and runs on the packer image to cleanup the powershell scripts that provisioned the image, but I am also seeing a similar error occur for other scripts as well, like the one below:

Windows PowerShell
    oracle-oci.server2019: Copyright (C) Microsoft Corporation. All rights reserved.
==> oracle-oci.server2019: The argument 'C:/Windows/Temp/packer-elevated-shell-64e01ace-0e63-ff7f-5e24-a97293581a92.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
    oracle-oci.server2019:
==> oracle-oci.server2019: Provisioning step had errors: Running the cleanup provisioner, if present...
==> oracle-oci.server2019: Terminating instance (ocid1.instance.oc1.iad.anuwcljsf256y7icqgcjn5wsjgxtbn5uql2cwzyhonomlikwhmjiggauvqqa)...
==> oracle-oci.server2019: Terminated instance.

I am not sure what is going on, but there appears to be some kind of issue with the powershell provisioner.

Reproduction Steps

  1. attempt to create a custom compute image using the oracle cloud infrastructure builder and a packer config similar to the one linked below.

Packer version

packer --version
1.9.4

Simplified Packer Template

https://gist.github.com/youngturk2/77adb13dbdbe721767d8bd97aaa2ebe9

Operating system and Environment details

Windows Server 2016

Log Fragments and crash.log files

https://gist.github.com/youngturk2/d1460e3eb22b473715f1e7e4b3a2659e

@youngturk2 youngturk2 added the bug label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant