Skip to content

Commit

Permalink
Update activation_key uses for SCA only
Browse files Browse the repository at this point in the history
  • Loading branch information
Griffin-Sullivan authored and evgeni committed Apr 18, 2024
1 parent 0ab7724 commit 313066b
Show file tree
Hide file tree
Showing 36 changed files with 1,028 additions and 1,728 deletions.
5 changes: 1 addition & 4 deletions plugins/modules/activation_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
description:
- List of subscriptions that include either Name, Pool ID, or Upstream Pool ID.
- Pool IDs are preferred since Names and Upstream Pool IDs are not guaranteed to be unique. The module will fail if it finds more than one match.
- This parameter is not supported in SCA mode.
type: list
elements: dict
suboptions:
Expand Down Expand Up @@ -172,10 +173,6 @@
host_collections:
- rhel7-servers
- rhel7-production
subscriptions:
- pool_id: "8a88e9826db22df5016dd018abdd029b"
- pool_id: "8a88e9826db22df5016dd01a23270344"
- name: "Red Hat Enterprise Linux"
content_overrides:
- label: rhel-7-server-optional-rpms
override: enabled
Expand Down
3 changes: 0 additions & 3 deletions tests/test_playbooks/activation_key.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@
activation_key_lifecycle_environment: "Library"
activation_key_content_view: "Default Organization View"
expected_change: true
expected_diff: true
expected_diff_before: "subscriptions.*\\[\\]"
expected_diff_after: "subscriptions.*\\[[^\\]]"
- name: create AK with CV, no change
include_tasks: tasks/activation_key.yml
vars:
Expand Down
51 changes: 22 additions & 29 deletions tests/test_playbooks/fixtures/activation_key-0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ interactions:
uri: https://foreman.example.org/api/status
response:
body:
string: '{"result":"ok","status":200,"version":"2.5.0","api_version":2}'
string: '{"satellite_version":"6.16.0","result":"ok","status":200,"version":"3.11.0-develop","api_version":2}'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '100'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -33,13 +35,11 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.5.0
- 3.11.0-develop
Keep-Alive:
- timeout=15, max=100
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -50,8 +50,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '62'
status:
code: 200
message: OK
Expand All @@ -70,17 +68,18 @@ interactions:
uri: https://foreman.example.org/katello/api/organizations?search=name%3D%22Test+Organization%22&per_page=4294967296
response:
body:
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\
: 4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\"\
: {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\"\
:\"Test_Organization\",\"created_at\":\"2021-06-22 14:20:36 UTC\",\"updated_at\"\
:\"2021-06-22 14:20:38 UTC\",\"id\":4,\"name\":\"Test Organization\",\"title\"\
:\"Test Organization\",\"description\":\"A test organization\"}]\n}\n"
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\":
4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\":
{\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Organization\",\"created_at\":\"2024-04-15
16:24:33 UTC\",\"updated_at\":\"2024-04-15 16:24:34 UTC\",\"id\":4,\"name\":\"Test
Organization\",\"title\":\"Test Organization\",\"description\":\"A test organization\"}]\n}\n"
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '388'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -94,13 +93,11 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.5.0
- 3.11.0-develop
Keep-Alive:
- timeout=15, max=99
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -111,8 +108,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '388'
status:
code: 200
message: OK
Expand All @@ -131,7 +126,7 @@ interactions:
uri: https://foreman.example.org/katello/api/organizations/4/activation_keys?search=name%3D%22Test+Activation+Key%22&per_page=4294967296
response:
body:
string: '{"total":0,"subtotal":0,"page":1,"per_page":"4294967296","error":null,"search":"name=\"Test
string: '{"total":0,"subtotal":0,"selectable":0,"page":1,"per_page":"4294967296","error":null,"search":"name=\"Test
Activation Key\"","sort":{"by":"name","order":"asc"},"results":[]}
'
Expand All @@ -140,6 +135,8 @@ interactions:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '174'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -153,13 +150,11 @@ interactions:
Foreman_current_organization:
- 4; Test Organization
Foreman_version:
- 2.5.0
- 3.11.0-develop
Keep-Alive:
- timeout=15, max=98
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -170,8 +165,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '159'
status:
code: 200
message: OK
Expand All @@ -194,17 +187,19 @@ interactions:
uri: https://foreman.example.org/katello/api/activation_keys
response:
body:
string: ' {"service_level":null,"content_overrides":[],"id":1,"name":"Test
string: ' {"service_level":null,"content_overrides":[],"id":16,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"auto_attach":true,"content_view_id":null,"environment_id":null,"usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":4,"organization":{"name":"Test
Organization","label":"Test_Organization","id":4},"created_at":"2021-06-22
14:20:47 UTC","updated_at":"2021-06-22 14:20:47 UTC","content_view":null,"environment":null,"products":[],"host_collections":[],"purpose_addons":[],"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}
Organization","label":"Test_Organization","id":4},"created_at":"2024-04-15
16:24:42 UTC","updated_at":"2024-04-15 16:24:42 UTC","content_view":null,"environment":null,"products":[],"host_collections":[],"purpose_addons":[],"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}
'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '675'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -218,13 +213,11 @@ interactions:
Foreman_current_organization:
- 4; Test Organization
Foreman_version:
- 2.5.0
- 3.11.0-develop
Keep-Alive:
- timeout=15, max=97
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Transfer-Encoding:
- chunked
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand Down
61 changes: 26 additions & 35 deletions tests/test_playbooks/fixtures/activation_key-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ interactions:
uri: https://foreman.example.org/api/status
response:
body:
string: '{"result":"ok","status":200,"version":"2.5.0","api_version":2}'
string: '{"satellite_version":"6.16.0","result":"ok","status":200,"version":"3.11.0-develop","api_version":2}'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '100'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -33,13 +35,11 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.5.0
- 3.11.0-develop
Keep-Alive:
- timeout=15, max=100
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -50,8 +50,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '62'
status:
code: 200
message: OK
Expand All @@ -70,17 +68,18 @@ interactions:
uri: https://foreman.example.org/katello/api/organizations?search=name%3D%22Test+Organization%22&per_page=4294967296
response:
body:
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\"\
: 4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\"\
: {\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\"\
:\"Test_Organization\",\"created_at\":\"2021-06-22 14:20:36 UTC\",\"updated_at\"\
:\"2021-06-22 14:20:38 UTC\",\"id\":4,\"name\":\"Test Organization\",\"title\"\
:\"Test Organization\",\"description\":\"A test organization\"}]\n}\n"
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\":
4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\":
{\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Organization\",\"created_at\":\"2024-04-15
16:24:33 UTC\",\"updated_at\":\"2024-04-15 16:24:34 UTC\",\"id\":4,\"name\":\"Test
Organization\",\"title\":\"Test Organization\",\"description\":\"A test organization\"}]\n}\n"
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '388'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -94,13 +93,11 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 2.5.0
- 3.11.0-develop
Keep-Alive:
- timeout=15, max=99
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -111,8 +108,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '388'
status:
code: 200
message: OK
Expand All @@ -131,18 +126,20 @@ interactions:
uri: https://foreman.example.org/katello/api/organizations/4/activation_keys?search=name%3D%22Test+Activation+Key%22&per_page=4294967296
response:
body:
string: '{"total":1,"subtotal":1,"page":1,"per_page":"4294967296","error":null,"search":"name=\"Test
Activation Key\"","sort":{"by":"name","order":"asc"},"results":[{"id":1,"name":"Test
string: '{"total":1,"subtotal":1,"selectable":1,"page":1,"per_page":"4294967296","error":null,"search":"name=\"Test
Activation Key\"","sort":{"by":"name","order":"asc"},"results":[{"id":16,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"auto_attach":true,"content_view_id":null,"environment_id":null,"usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":4,"organization":{"name":"Test
Organization","label":"Test_Organization","id":4},"created_at":"2021-06-22
14:20:47 UTC","updated_at":"2021-06-22 14:20:47 UTC","content_view":null,"environment":null,"products":[],"host_collections":[],"purpose_addons":[],"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}]}
Organization","label":"Test_Organization","id":4},"created_at":"2024-04-15
16:24:42 UTC","updated_at":"2024-04-15 16:24:42 UTC","content_view":null,"environment":null,"products":[],"host_collections":[],"purpose_addons":[],"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}]}
'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '802'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -156,13 +153,11 @@ interactions:
Foreman_current_organization:
- 4; Test Organization
Foreman_version:
- 2.5.0
- 3.11.0-develop
Keep-Alive:
- timeout=15, max=98
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -173,8 +168,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '786'
status:
code: 200
message: OK
Expand All @@ -190,20 +183,22 @@ interactions:
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: GET
uri: https://foreman.example.org/katello/api/activation_keys/1?organization_id=4
uri: https://foreman.example.org/katello/api/activation_keys/16?organization_id=4
response:
body:
string: ' {"service_level":null,"content_overrides":[],"id":1,"name":"Test
string: ' {"service_level":null,"content_overrides":[],"id":16,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"auto_attach":true,"content_view_id":null,"environment_id":null,"usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":4,"organization":{"name":"Test
Organization","label":"Test_Organization","id":4},"created_at":"2021-06-22
14:20:47 UTC","updated_at":"2021-06-22 14:20:47 UTC","content_view":null,"environment":null,"products":[],"host_collections":[],"purpose_addons":[],"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}
Organization","label":"Test_Organization","id":4},"created_at":"2024-04-15
16:24:42 UTC","updated_at":"2024-04-15 16:24:42 UTC","content_view":null,"environment":null,"products":[],"host_collections":[],"purpose_addons":[],"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}
'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '675'
Content-Security-Policy:
- 'default-src ''self''; child-src ''self''; connect-src ''self'' ws: wss:;
img-src ''self'' data:; script-src ''unsafe-eval'' ''unsafe-inline'' ''self'';
Expand All @@ -217,13 +212,11 @@ interactions:
Foreman_current_organization:
- 4; Test Organization
Foreman_version:
- 2.5.0
- 3.11.0-develop
Keep-Alive:
- timeout=15, max=97
Strict-Transport-Security:
- max-age=631139040; includeSubdomains
Vary:
- Accept-Encoding
X-Content-Type-Options:
- nosniff
X-Download-Options:
Expand All @@ -234,8 +227,6 @@ interactions:
- none
X-XSS-Protection:
- 1; mode=block
content-length:
- '674'
status:
code: 200
message: OK
Expand Down
Loading

0 comments on commit 313066b

Please sign in to comment.