Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Make Promote() use cv version which user defined in YAML, not just latest #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lvw5264
Copy link

@lvw5264 lvw5264 commented Mar 12, 2019

Pull request verbatim from the tested code in issue #62. To reiterate:

I had a use case where we don't use composite content views, yet I wanted the promote command to use the content view version I defined. However, for some reason the promote command always uses the latest and does not check for the version the user defined in :cv: under YAML at all.

I suggest a solution in the code below, allowing the user specified version in YAML to be used, as well as latest. since I just hacked this together by combining aspects of the update() function, I will just paste the promote() function I made.

Also when the request in promote() gave a 400 bad request, as the exception was not handled, so I added a rescue statement, which now helpfully tells the command line user that they "Cannot promote environment out of sequence. Use force to bypass restriction.".

The YAML I use, where i have Library.yaml , dev.yaml (always kept up to date with Library), test.yaml, prod.yaml.

# prod.yaml
:settings:
  :user: admin
  :pass: YOURPASSWORD
  :uri: https://localhost
  :timeout: 300
  :org: 1              # always 1 
  :lifecycle: 6        # ID of the lifecycle, not always obvious
  :checkrepos: true    # check if the latest repo packages are already in the curre
nt content view
  :promote_cvs: true   # don't use composite content views for publishing
  :keep: 5
  :wait: false         # should cvmanager wait for tasks to finish, or run them in 
the background
  :sequential: 1       # run only one task at once
:cv:
  rhel7: 10.0   # I specifically want version 10 and not the latest 12
:publish:
  - rhel7
:promote:
  - rhel7

@Rocco83
Copy link
Contributor

Rocco83 commented Mar 12, 2019

This is already in
Rocco83@c6fb789#diff-f7030f12fde1940699c8be343ca6945aR302
Am i wrong?

@kallies
Copy link

kallies commented Apr 10, 2019

This change introduces the issue, that regular promotes are not possible anymore:

We use

cvmanager --config=cvmanager-201904.yaml --user=cvmanager --pass=cvmanagerpass --uri=https://satellite.example.com --organization-id=1 --force --wait --description 'promote to lce 2 201904' promote --to-lifecycle-environment 2

with the following config

---
:settings:
  :timeout: 300
  :keep: 8
  :verify_ssl: true
:ccv:
  ccv-lin7:
    cv-lin7-os: 123.0
:publish:
  - cv-lin7-os
:promote:
  - ccv-lin-7

For explicit CCV version promotes we use (with this PR included in cvmanager)

---
:settings:
  :timeout: 300
  :keep: 8
  :verify_ssl: true
:cv:
  ccv-lin7: 10.0
:ccv:
  ccv-lin7:
    cv-lin7-os: 123.0
:publish:
  - cv-lin7-os
:promote:
  - ccv-lin-7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants