Merge lp:~chmouel/nova/lp684657 into lp:~hudson-openstack/nova/trunk

Proposed by Chmouel Boudjnah
Status: Rejected
Rejected by: Devin Carlen
Proposed branch: lp:~chmouel/nova/lp684657
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 21 lines (+8/-2)
1 file modified
nova/auth/novarc.template (+8/-2)
To merge this branch: bzr merge lp:~chmouel/nova/lp684657
Reviewer Review Type Date Requested Status
Eric Day (community) Needs Information
Thierry Carrez (community) Disapprove
Review via email: mp+42624@code.launchpad.net

Description of the change

Trivial fixes and improvement to novarc

To post a comment you must log in.
lp:~chmouel/nova/lp684657 updated
442. By Chmouel Boudjnah

make the change more robust.

- make sure it's compatible between zsh and bash.

Revision history for this message
Soren Hansen (soren) wrote :

2010/12/3 Chmouel Boudjnah <email address hidden>:
> === modified file 'nova/auth/novarc.template'
> --- nova/auth/novarc.template   2010-07-15 15:52:11 +0000
> +++ nova/auth/novarc.template   2010-12-03 14:23:53 +0000
> @@ -1,3 +1,5 @@
> +[ -n $BASH_SOURCE ] || BASH_SOURCE=$(readlink -f $0)
> +

This won't work. novarc is sourced, not run as a script, so $0
is "bash" or something like that. What you need is an equivalent
of __file__.

> -alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
> -alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"
> +
> +[ -x /usr/bin/ec2-bundle-image ] && E_B_IMG=/usr/bin/ec2-bundle-image || E_B_IMG=/usr/bin/euca-bundle-image
> +[ -x /usr/bin/ec2-upload-image ] && E_U_IMG=/usr/bin/ec2-upload-bundle || E_U_IMG=/usr/bin/euca-upload-bundle
> +
> +alias ${E_B_IMG}="${E_B_IMG} --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
> +alias ${E_U_IMG}="${E_U_IMG} -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"

I'm not sure this is necessary. I've succesfully run euca-*bundle*
without any problems without this fix?

--
Soren Hansen
Ubuntu Developer    http://www.ubuntu.com/
OpenStack Developer http://www.openstack.org/

Revision history for this message
Thierry Carrez (ttx) wrote :

I confirm this is not needed. Only the ec2-* tools need to be aliased to contain extra parameters. euca-* tools don't need those.

review: Disapprove
Revision history for this message
Eric Day (eday) wrote :

Should we mark this as rejected, or does it need fixing?

review: Needs Information
Revision history for this message
Thierry Carrez (ttx) wrote :

My take is that we should reject it, but Chmouel might stand up and defend his change :)

Revision history for this message
Chmouel Boudjnah (chmouel) wrote :

On 22/12/2010 16:45, Thierry Carrez wrote:
> My take is that we should reject it, but Chmouel might stand up and defend his change :)
Well things are still not working when using a different shell than bash
which is a bit annoying but I would not call it a critical bug (we
supposed to use OpenStack API these days anyway).

Chmouel.

Revision history for this message
Thierry Carrez (ttx) wrote :

Right, this covers in fact two bugs, one of which is invalid, and the other is Low prio. We should reject this branch and wait for a version that only fixes the bashisms.

Chmouel: in all cases, could you file a separate bug for the "doesn't run in bash" issue so that we don't lose track of that ?

Revision history for this message
Chmouel Boudjnah (chmouel) wrote :

> Chmouel: in all cases, could you file a separate bug for the "doesn't run in
> bash" issue so that we don't lose track of that ?

Sure I will do that!

Revision history for this message
Devin Carlen (devcamcar) wrote :

Looks like this has been thoroughly discussed and the consensus is to reject this patch. I'll mark it as such.

Unmerged revisions

442. By Chmouel Boudjnah

make the change more robust.

- make sure it's compatible between zsh and bash.

441. By Chmouel Boudjnah

Fix for novarc.

- Use euca-* prefix instead of ec2 when ec2 tools are not present.
- Make it zsh compatible (probably compatible against other bourne shells but
  not tested).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/auth/novarc.template'
2--- nova/auth/novarc.template 2010-07-15 15:52:11 +0000
3+++ nova/auth/novarc.template 2010-12-03 14:29:41 +0000
4@@ -1,3 +1,5 @@
5+[[ -n $BASH_SOURCE ]] || BASH_SOURCE=$(readlink -f $0)
6+
7 NOVA_KEY_DIR=$(pushd $(dirname $BASH_SOURCE)>/dev/null; pwd; popd>/dev/null)
8 export EC2_ACCESS_KEY="%(access)s:%(project)s"
9 export EC2_SECRET_KEY="%(secret)s"
10@@ -8,5 +10,9 @@
11 export EC2_CERT=${NOVA_KEY_DIR}/%(cert)s
12 export NOVA_CERT=${NOVA_KEY_DIR}/%(nova)s
13 export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set
14-alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
15-alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"
16+
17+[[ -x /usr/bin/ec2-bundle-image ]] && E_B_IMG=/usr/bin/ec2-bundle-image || E_B_IMG=/usr/bin/euca-bundle-image
18+[[ -x /usr/bin/ec2-upload-image ]] && E_U_IMG=/usr/bin/ec2-upload-bundle || E_U_IMG=/usr/bin/euca-upload-bundle
19+
20+alias ${E_B_IMG##*/}="${E_B_IMG} --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
21+alias ${E_U_IMG##*/}="${E_U_IMG} -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"