image with rhel element can't be built if DIB_RHSM_* variables aren't set

Bug #1318717 reported by Ivan Berezovskiy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
diskimage-builder
Fix Released
Medium
Ivan Berezovskiy

Bug Description

If you use 'rhel' element for building not-rhel image (CentOS, for example) you shouldn't export parameters like DIB_RHSM_USER, DIB_RHSM_PASSWORD and etc. So, if this parameters are unset, the image build fails with error:

/tmp/in_target.d/pre-install.d/00-rhsm: line 6: DIB_RHSM_USER: unbound variable

Now all scripts have 'set -u', so if any parameter isn't set but it's used in script, then script running fails.

So, I suggest to add line in 'rhel /pre-install.d/00-rhsm' and in 'rhel/finalise.d/60-rhsm-unregister' before 'if' section:

export DIB_RHSM_USER=${DIB_RHSM_USER:-}

If 'DIB_RHSM_USER' will not set, script will not enter in 'if' section because first condition will be false and another variables will not be checked.
It will help to use rhel element with non-rhel images like CentOS.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to diskimage-builder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/93387

Changed in diskimage-builder:
assignee: nobody → Ivan Berezovskiy (iberezovskiy)
status: New → In Progress
Ben Nemec (bnemec)
Changed in diskimage-builder:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to diskimage-builder (master)

Reviewed: https://review.openstack.org/93387
Committed: https://git.openstack.org/cgit/openstack/diskimage-builder/commit/?id=8995d6402af864a23ee0e50ed7f338395f29d9a4
Submitter: Jenkins
Branch: master

commit 8995d6402af864a23ee0e50ed7f338395f29d9a4
Author: iberezovskiy <email address hidden>
Date: Tue May 13 11:56:53 2014 +0400

    Export unbound variable DIB_RHSM_USER

    If 'DIB_RHSM_USER' isn't set, the image build with rhel
    element fails because of check 'set -u'. So, we should export
    'DIB_RHSM_USER' in script to avoid error during build

    Change-Id: Ic63a20e3d91a25bbe804440a5919b035489c60a3
    Closes-bug: #1318717

Changed in diskimage-builder:
status: In Progress → Fix Committed
Changed in diskimage-builder:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.