Project

General

Profile

Actions

Bug #36497

closed

Can't remove GPG and SSL Keys from existing Product using the API

Added by Evgeni Golov over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Repositories
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2213777

Description of problem:

It's not possible to unset GPG keys when I use the theforeman.foreman.product module (and it's the same with the satellite modules as well.

I have the following product defined as a variable:

product_list:
- name: test_product
label: prod_test_product
description: "Test Product"
gpg_key: MyCustomGPG
sync_play: Daily

I have a task in a playbook defined as follows:

- name: Manage Satellite products
theforeman.foreman.product:
username: "{{ rhs_satellite_admin }}"
password: "{{ rhs_satellite_admin_password }}"
server_url: "{{ rhs_satellite_server_url }}"
organization: "{{ rhs_org }}"
validate_certs: "{{ rhs_validate_certs }}"
gpg_key: "{{ item.gpg_key | default(omit) }}"
name: "{{ item.product_name }}"
label: "{{ item.label | default (omit) }}"
description: "{{ item.description | default(omit) }}"
sync_plan: "{{ item.sync_plan | default(omit) }}"
ssl_ca_cert: "{{ item.ssl_ca_cert | default(omit) }}"
ssl_client_cert: "{{ item.ssl_client_cert | default(omit) }}"
ssl_client_key: "{{ item.ssl_client_key | default(omit) }}"
state: "{{ item.state | default('present_with_defaults') }}"
loop: "{{ product_list }}"

Provided that the GPG Key and/or the sync plan we define in the variable exist, the task will be completed successfully.

Now, if for any reason I want to modify the product and disassociate the defined GPG key, or the sync plan, I change the variable as follows:

product_list:
- name: test_product
label: prod_test_product
description: "Test Product"
gpg_key: ""
sync_play: ""

Now when I run the playbook, the specific task fails with the following error:

-----
msg: 'Error while performing update on products: gpg_key_id can''t be None'
-----

How reproducible: Always

Steps to Reproduce:
1. Create a new playbook with a single task as above
2. Define the variable as above
3. Run the playbook against a Satellite/Katello server

Actual results: Error

Expected results: Product is updated and the sync plan/GPG key is disassociated.

Additional info: I don't know if the the SSL options have the same issue, but it is quite possible. I haven't tested them.


Related issues 1 (1 open0 closed)

Related to Foreman - Tracker #27680: API bugs that need workarounds in foreman-ansible-modulesNew

Actions
Actions #1

Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Assignee set to Evgeni Golov
  • Pull request https://github.com/Katello/katello/pull/10593 added
Actions #2

Updated by Evgeni Golov over 1 year ago

  • Related to Tracker #27680: API bugs that need workarounds in foreman-ansible-modules added
Actions #3

Updated by The Foreman Bot over 1 year ago

  • Fixed in Releases Katello 4.10.0 added
Actions #4

Updated by Evgeni Golov over 1 year ago

  • Status changed from Ready For Testing to Closed
Actions #5

Updated by Partha Aji over 1 year ago

  • Subject changed from Can't remove GPG and SSL Keys from existing Product using the API to Can't remove GPG and SSL Keys from existing Product using the API
  • Triaged changed from No to Yes
  • Fixed in Releases Katello 4.9.0 added
  • Fixed in Releases deleted (Katello 4.10.0)
Actions #6

Updated by Ian Ballou over 1 year ago

  • Status changed from Closed to Assigned
  • Target version set to Katello 4.10.0
Actions #7

Updated by Ian Ballou over 1 year ago

  • Status changed from Assigned to Closed
Actions #8

Updated by William Clark about 1 year ago

  • Target version changed from Katello 4.10.0 to Katello 4.9.2
Actions #9

Updated by The Foreman Bot about 1 year ago

  • Pull request https://github.com/Katello/katello/pull/10754 added
Actions #10

Updated by The Foreman Bot about 1 year ago

  • Pull request deleted (https://github.com/Katello/katello/pull/10593, https://github.com/Katello/katello/pull/10754)
Actions #11

Updated by The Foreman Bot about 1 year ago

  • Fixed in Releases Katello 4.9.2 added
Actions #12

Updated by Ewoud Kohl van Wijngaarden about 1 year ago

  • Fixed in Releases deleted (Katello 4.9.0)
Actions

Also available in: Atom PDF