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

Add OwnerName to ApplicationOfferFilter #201

Merged
merged 1 commit into from
May 4, 2023

Conversation

hemanthnakkina
Copy link
Contributor

@hemanthnakkina hemanthnakkina commented May 2, 2023

Description

CreateOffer fails in finding the application offer if the controller model owner is different from the current user.
This is due to missing additional filter OwnerName for ApplicationOffers.

This PR gets the ModelOwner from model client and updates the filter to use OwnerName.

Type of change

Please mark if proceeds.

  • New resource (a new resource in the schema)
  • Changed resource (changes in an existing resource)
  • Logic changes in resources (the API interaction with Juju has been changed)
  • Test changes (one or several tests have been changed)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Other (describe)

Environment

  • Juju controller version: 3.2/beta
  • Terraform version: 1.4.5

QA steps

Manual QA steps should be done to test this PR.

# Install terraform and yq
sudo snap install terraform --classic
sudo snap install yq

# Bootstrap juju on lxd
juju bootstrap localhost

# Add new juju user
juju add-user test
juju grant test superuser
juju grant test write controller
juju register <>

# Get terraform files
mkdir test
cd test
wget https://raw.githubusercontent.com/hemanthnakkina/snap-openstack/microceph/cloud/etc/deploy-microceph/main.tf
wget https://raw.githubusercontent.com/hemanthnakkina/snap-openstack/microceph/cloud/etc/deploy-microceph/variables.tf

# Set juju env variables
export CONTROLLER=$(juju whoami | yq .Controller)
export JUJU_CONTROLLER_ADDRESSES="$(juju show-controller | yq '.[$CONTROLLER]'.details.\"api-endpoints\" | tr -d "[]' "|tr -d '"'|tr -d '\n')"
export JUJU_CA_CERT="$(juju show-controller $(echo $CONTROLLER|tr -d '"') | yq '.[$CONTROLLER]'.details.\"ca-cert\"|tr -d '"'|sed 's/\\n/\n/g')"
export JUJU_USERNAME=test
export JUJU_PASSWORD=<>

# Run terraform plan
terraform init
terraform apply -auto-approve

See #199 for more details.

FindApplicationOffers fails if controller model owner is
different from the current user. This patch adds ModelOwner
to CreateOfferInput type and adds OwnerName to filter offers.
This enables to filter offers based on controller model owner
name.

Fixes: juju#199
@juanmanuel-tirado
Copy link
Contributor

Please provide some manual QA steps.

@hemanthnakkina
Copy link
Contributor Author

Please provide some manual QA steps.

Manual QA steps are added.

Copy link
Contributor

@juanmanuel-tirado juanmanuel-tirado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R2GO

@juanmanuel-tirado
Copy link
Contributor

Manual QA passed. Failing tests are not related with this PR. This is ready to go.

Thanks for taking your time to fix this issue. Happy terraforming :)

@juanmanuel-tirado
Copy link
Contributor

Close #199

@juanmanuel-tirado juanmanuel-tirado merged commit c097ca1 into juju:main May 4, 2023
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

Successfully merging this pull request may close these issues.

2 participants