Bug #28133
openCreating an image in CR scoped with taxonomies throws error 'undefined method `images' for #<Location:0x00007f752b274e88>'
Description
Creating an image in taxonomies throws an error : http://pastebin.test.redhat.com/806577 but works without taxonomies.
How Reproducible:
-------------------
Always
Steps:
-------------------
1. Attempt to create an image in GCE Compute Resource scoped with some taxonomies.
- hammer compute-resource image create --compute-resource-id 1 --name testimg --user-data false --uuid 4654324179607992309 --username gcehost --organization-id 1 --location-id 2 --architecture-id 1
Actual Behavior:
-------------------
The image creation fails with an error 'undefined method `images' for #<Location:0x00007f752b274e88>. More deatils in Pastebin mentioned in description of this bug.
Expected Behavior:
--------------------
1. An image cannot be scoped to taxonomies as they are scoped with Compute Resource so better if we can remove the taxonomies option from image creation.
Updated by Oleh Fedorenko about 5 years ago
- Project changed from Hammer CLI to Foreman
- Subject changed from Creating an image in GCE CR scoped with taxonomies throws error 'undefined method `images' for #<Location:0x00007f752b274e88>' to Creating an image in CR scoped with taxonomies throws error 'undefined method `images' for #<Location:0x00007f752b274e88>'
- Category changed from Compute resources to Compute resources
Moving from hammer to API since it's common issue for all CRs even when creating directly via API calls.
I've tried the same, but with curl:
curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -u admin:changeme -X POST -d "{\"location_id\":2,\"organization_id\":1,\"image\": {\"name\": \"testimg\", \"uuid\":\"4654324179607992309\", \"username\":\"gcehost\",\"user_data\": false }}" -k https://foreman.example.com/api/compute_resources/1/images
Updated by Kavita Gaikwad almost 5 years ago
@Oleh,
Hammer shows taxonomy options i.e --organization-id & --location-id while creating an image.
There are no parameter options i.e {organization/location}_id mentioned under POST API /api/compute_resources/:compute_resource_id/images.
By seeing at the Foreman core side, image resource is non-taxable whereas compute-resource is taxable resource.
From Web UI, any user can access images through Compute resource.
As compute-resource is taxable, on taxonomy selection it hides/shows CR records so user can perform actions on images only when they can select compute resource.
I think, both sides (Hammer + Foreman core) needs to be handled properly.