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

Pulumi policy v1.11.0 treated as resource plugin and fails to install with python #356

Closed
stooj opened this issue Jul 10, 2024 · 1 comment · Fixed by #358
Closed

Pulumi policy v1.11.0 treated as resource plugin and fails to install with python #356

stooj opened this issue Jul 10, 2024 · 1 comment · Fixed by #358
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@stooj
Copy link

stooj commented Jul 10, 2024

What happened?

When I run the pulumi plugin install command for a project with pulumi-policy, the command tries to install pulumi-policy as a resource plugin and fails.

Example

Error message:

pulumi plugin install                                                           ─╯

[resource plugin pulumi_policy-1.11.0] installing
error: [resource plugin pulumi_policy-1.11.0] downloading from : failed to download plugin: pulumi_policy-1.11.0: 403 HTTP error fetching plugin from https://get.pulumi.com/releases/plugins/pulumi-resource-pulumi_policy-v1.11.0-linux-amd64.tar.gz

To reproduce:

pulumi new -y gcp-python
echo "pulumi-policy" >> requirements.txt
venv/bin/pip install -r requirements.txt
pulumi plugin install

This issue is not present in v1.10.0.

It happens with poetry as well.

I was not able to reproduce this using Typescript, so I think it's limited to python projects.

Output of pulumi about

CLI
Version      3.122.0
Go Version   go1.22.4
Go Compiler  gc

Plugins
KIND      NAME           VERSION
resource  gcp            7.30.1
resource  pulumi_policy  1.11.0
language  python         unknown

Host
OS       nixos
Version  24.05 (Uakari)
Arch     x86_64

This project is written in python: executable='/home/stooj/code/pulumi/stooj/pulumi-support/5480/policy6/venv/bin/python' version='3.11.9'

Current Stack: stooj/5480-6/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend
Name           pulumi.com
URL            https://app.pulumi.com/stooj
User           stooj
Organizations  stooj, team-ce, higara, demo
Token type     personal

Dependencies:
NAME                    VERSION
aiodns                  3.2.0
aiohttp                 3.9.5
asn1crypto              1.5.1
async-timeout           4.0.3
awscli                  2.15.43
azure-cli               2.60.0
azure-loganalytics      0.1.1
azure-mgmt-common       0.20.0
azure-mgmt-consumption  10.0.0
azure-mgmt-relay        1.1.0
azure-storage-blob      12.19.1
bcdoc                   0.16.0
black                   24.4.0
botocore                1.34.87
Brotli                  1.1.0
brotlicffi              1.1.0.0
curio                   1.6
Jinja2                  3.1.4
pbr                     6.0.0
pip                     24.1.2
poetry                  1.8.3
pulumi_gcp              7.30.1
pulumi_policy           1.11.0
pyasn1                  0.6.0
python-socks            2.4.4
redis                   5.0.3
ruamel.base             1.0.0
setuptools              69.5.1.post0
trio                    0.25.0
wheel                   0.43.0

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@stooj stooj added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jul 10, 2024
@justinvp justinvp self-assigned this Jul 12, 2024
@justinvp justinvp added this to the 0.107 milestone Jul 12, 2024
@justinvp
Copy link
Member

This is the same underlying reason as pulumi/pulumi#15536 and is due to a behavior change in v69.0.3 and later of setuptools.

Comparing the content of the two .whl files downloaded from PyPi for v1.10.0 vs. v1.11.0:

Screenshot 2024-07-12 at 4 57 44 PM

v1.10.0 has a name of pulumi-policy whereas v1.11.0 is now pulumi_policy.

Note that we do have a mechanism for a package to indicate it doesn't have an associated plugin: the package can include a pulumi-plugin.json file with { "resource": false }. However, for a brief period of time the file we looked for was originally called pulumiplugin.json. It was renamed to pulumi-plugin.json in pulumi/pulumi#8593 when it was going to actually be used more broadly. However, pulumi-policy is still using the old name.

This hasn't mattered because there is an explicit exemption for pulumi-policy in the code that looks for plugins in the Python language host for even older versions of pulumi-policy that didn't have a pulumiplugin.json file. Which is what has been preventing the plugin install attempts until now for v1.10.0 and earlier. But now that exception is no longer working because of the name change due to the setuptools behavior change.

So there are two fixes here:

  1. Rename pulumiplugin.json to pulumi-plugin.json in pulumi-policy and release a new version.
  2. Fix-up the Python language host to exclude both pulumi_policy and pulumi-policy.

@justinvp justinvp removed the needs-triage Needs attention from the triage team label Jul 13, 2024
github-merge-queue bot pushed a commit to pulumi/pulumi that referenced this issue Jul 22, 2024
In the Python language host, we hardcode that `pulumi-policy` doesn't
have an associated resource (provider) plugin, because we know it
doesn't have one.

However, this hardcode no longer works with the latest version of
`pulumi-policy` (v1.11.0) because it was built with a newer version of
`setuptools` which has a behavior change where the package name in the
metadata will now allow underscores, instead of having underscores
replaced with hyphens (pypa/setuptools#4159).
This means that the package name reported from `pip list` is now
`pulumi_policy` instead of `pulumi-policy`, which doesn't match the
hardcoded list.

Note that this change is really only to help with `pulumi-policy`
v1.11.0. Future versions of `pulumi-policy` will have a
`pulumi-plugin.json` file in the package, which properly indicates that
it doesn't have an associated plugin.

Related: pulumi/pulumi-policy#358
Part of addressing: pulumi/pulumi-policy#356
github-merge-queue bot pushed a commit to pulumi/pulumi that referenced this issue Jul 22, 2024
In the Python language host, we hardcode that `pulumi-policy` doesn't
have an associated resource (provider) plugin, because we know it
doesn't have one.

However, this hardcode no longer works with the latest version of
`pulumi-policy` (v1.11.0) because it was built with a newer version of
`setuptools` which has a behavior change where the package name in the
metadata will now allow underscores, instead of having underscores
replaced with hyphens (pypa/setuptools#4159).
This means that the package name reported from `pip list` is now
`pulumi_policy` instead of `pulumi-policy`, which doesn't match the
hardcoded list.

Note that this change is really only to help with `pulumi-policy`
v1.11.0. Future versions of `pulumi-policy` will have a
`pulumi-plugin.json` file in the package, which properly indicates that
it doesn't have an associated plugin.

Related: pulumi/pulumi-policy#358
Part of addressing: pulumi/pulumi-policy#356
github-merge-queue bot pushed a commit to pulumi/pulumi that referenced this issue Jul 22, 2024
In the Python language host, we hardcode that `pulumi-policy` doesn't
have an associated resource (provider) plugin, because we know it
doesn't have one.

However, this hardcode no longer works with the latest version of
`pulumi-policy` (v1.11.0) because it was built with a newer version of
`setuptools` which has a behavior change where the package name in the
metadata will now allow underscores, instead of having underscores
replaced with hyphens (pypa/setuptools#4159).
This means that the package name reported from `pip list` is now
`pulumi_policy` instead of `pulumi-policy`, which doesn't match the
hardcoded list.

Note that this change is really only to help with `pulumi-policy`
v1.11.0. Future versions of `pulumi-policy` will have a
`pulumi-plugin.json` file in the package, which properly indicates that
it doesn't have an associated plugin.

Related: pulumi/pulumi-policy#358
Part of addressing: pulumi/pulumi-policy#356
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants