Skip to content

Commit

Permalink
Fix client bindings install for old status
Browse files Browse the repository at this point in the history
Older versions of pulpcore do not include the python-package in the
status response. The solution is to guess the package name from the
app_label. This mostly works, because we substitute "_" with "-" anyway.

[noissue]
  • Loading branch information
mdellweg committed Nov 24, 2023
1 parent 65d7a35 commit d70d908
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions templates/github/.github/workflows/scripts/script.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ password password
# Some commands like ansible-galaxy specifically require 600
cmd_prefix bash -c "chmod 600 ~pulp/.netrc"

# Workaround: Domains are not supported by the published bindings.
# Infer the client name from the package name by replacing "-" with "_".
# Use the component to infer the package name on older versions of pulpcore.

if [ "$(echo "$REPORTED_STATUS" | jq -r '.domain_enabled')" = "true" ]
then
# Workaround: Domains are not supported by the published bindings.
# Generate new bindings for all packages.
pushd ../pulp-openapi-generator
for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[].package|sub("-"; "_")')
for item in $(echo "$REPORTED_STATUS" | jq -r '.versions[]|(.package // ("pulp_" + .component)|sub("pulp_core"; "pulpcore"))|sub("-"; "_")')
do
./generate.sh "${item}" python
cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client"
Expand All @@ -65,7 +69,7 @@ else
{%- for plugin in plugins -%}
|select(.component!="{{ plugin.app_label }}")
{%- endfor -%}
.package|sub("-"; "_")')
|(.package // ("pulp_" + .component)|sub("pulp_core"; "pulpcore"))|sub("-"; "_")')
do
./generate.sh "${item}" python
cmd_prefix pip3 install "/root/pulp-openapi-generator/${item}-client"
Expand Down

0 comments on commit d70d908

Please sign in to comment.