Hammer content-view version promote help

Problem: I added a new content view to my composite content view and have published a new version of the composite content view. I now want to promote it through the lifecycles. I got the current version of the composite content view with:

CURVERS=$(hammer content-view version list --content-view-id ${ID} | grep -vE 'VERSION|\---' | awk '{ print $6 }' | sort -nr | head -1)
hammer content-view version promote --content-view-id ${ID} \
   --id ${CURVERS} --to-lifecycle-environment "${NAM}"

and I get back:

Could not promote the content view:
  Error: Option '--id': Numeric value is required..

${CURVERS} value is 12.0. That is the correct value. Bash does not type its variables. So, I can’t cast it to a float or some-such. I checked for some hidden characters in the variable with:

echo "X${CURVERS}X"
X12.0X

which is what I expected. What am I missing?
Expected outcome: content view gets promoted

Foreman and Proxy versions: foreman: 2.4.0, katello: 4.0.1-1

Foreman and Proxy plugin versions:

Distribution and version: CentOS 7.9

Other relevant data:

Never mind. I figured it out. :slight_smile:
I was using the wrong value for the version id. I changed it to:

CURVERS=$(hammer --csv content-view version list --content-view-id ${ID} | grep -v 'Id,Name' | head -1 | cut -d, -f1)

and that worked.

1 Like