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

Failed to parse with script plugin error post macOS upgrade (Terraform remote state?) #25

Closed
balaji-dutt opened this issue May 28, 2022 · 2 comments

Comments

@balaji-dutt
Copy link

Hi,

I'm aware that there is an open issue (#21) but given it's a couple of years old I'm not sure the workarounds mentioned in there are still correct. In addition, I've started seeing this error quite recently after upgrading to macOS Monterey so I'm not sure if it's some type of broken dependency.

I'm seeing the following error when I try to run any ansible command with the Inventory script:

❯ ansible -i /Users/balaji/Applications/terraform.py online -m ping
/usr/local/Cellar/[email protected]/5.7.1/libexec/lib/python3.10/site-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
[WARNING]:  * Failed to parse /Users/balaji/Applications/terraform.py with script plugin: Inventory script
(/Users/balaji/Applications/terraform.py) had an execution error: env: python: No such file or directory
[WARNING]:  * Failed to parse /Users/balaji/Applications/terraform.py with ini plugin: /Users/balaji/Applications/terraform.py:3: Error
parsing host definition ''''': No closing quotation
[WARNING]: Unable to parse /Users/balaji/Applications/terraform.py as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: online

Terraform state is stored remotely, but I'm able to retrieve Terraform state in the same directory without any error:

❯ terraform state list
data.aws_ssm_parameter.proxmox_api_address
data.aws_ssm_parameter.proxmox_login
data.aws_ssm_parameter.proxmox_login_secret
ansible_host.airconnect
ansible_host.devdesktop
... [output snipped]

Is there some way to debug this issue further? I've tried adding the ANSIBLE_TF_DIR variable when running ansible commands but that doesn't seem to change anything.

@cooperaj
Copy link

Python has apparently been removed in the latest macOS version. env: python: No such file or directory is literally saying that python can't be found.

Would recommend installing python via homebrew and ensuring it's linked on your path as versionless (i.e. python not [email protected]).

You'll still hit issues with the script being incompatible with python 3.9 but that can be fixed by amending line 390 to remove the encoding specification.

@balaji-dutt
Copy link
Author

Python has apparently been removed in the latest macOS version. env: python: No such file or directory is literally saying that python can't be found.

D-oh! That'll teach me to not read error messages properly. python3 is available on $PATH as a versionless executable so I just modified Line 1 to reference python3

You'll still hit issues with the script being incompatible with python 3.9 but that can be fixed by amending line 390 to remove the encoding specification.

Thanks for pointing out that gotcha as well @cooperaj. Once I made the change to the env line and the edit on Line 390, things started working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants