euca2ools parsing of config file is severely limited

Bug #526591 reported by Scott Moser
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
euca2ools
Fix Released
Undecided
Unassigned
euca2ools (Ubuntu)
Fix Released
Low
Dustin Kirkland 
Lucid
Fix Released
Low
Dustin Kirkland 

Bug Description

Binary package hint: euca2ools

The euca2ools reading of user or system config file is very limited.

The reason for this is that the config file is bash syntax (expected to be sourced by bash in .bash_profile or such), but the parsing is a limited parsing done with python and string replacements (see euca2ools/__init__.py:setup_environ):

~ line 360
| if read_config:
| lines = eucarc.readlines()
| comment = re.compile('^#')
| for line in lines:
| line = line.strip('export')
| line = line.replace('\'', '')
| line = line.strip()
| line = line.replace('${EUCA_KEY_DIR}', base_path)
| if not comment.match(line):
| parts = line.split('=', 1)
| if len(parts) == 2:
| self.environ[parts[0]] = parts[1]

The following easily demonstrates the issue:

$ mkdir euca && cd euca
$ sudo euca_conf --get-credentials mycreds.zip
$ unzip mycreds.zip
$ ln -s $PWD/eucarc ~/.eucarc
$ euca-bundle-image --image mycreds.zip
Invalid cert
$ egrep "(EUCA_KEY_DIR=|EC2_CERT=)" ~/.eucarc
EUCA_KEY_DIR=$(dirname $(readlink -f ${BASH_SOURCE}))
export EC2_CERT=${EUCA_KEY_DIR}/euca2-admin-1a4bb4d0-cert.pem

If bash is the syntax for the config file, then it makes most to use bash to parse the config file, rather than limited python as above.

ProblemType: Bug
Architecture: amd64
Date: Tue Feb 23 12:50:57 2010
DistroRelease: Ubuntu 10.04
InstallationMedia: Error: [Errno 13] Permission denied: '/var/log/installer/media-info'
Package: euca2ools 1.2-0ubuntu1 [modified: usr/share/pyshared/euca2ools/__init__.py]
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-14.20-server
SourcePackage: euca2ools
Uname: Linux 2.6.32-14-server x86_64

Related branches

Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

Attaching suggested fix.

Changed in euca2ools (Ubuntu):
importance: Undecided → Low
Scott Moser (smoser)
Changed in euca2ools (Ubuntu Lucid):
milestone: none → ubuntu-10.04-beta-1
tags: added: patch
Thierry Carrez (ttx)
Changed in euca2ools (Ubuntu Lucid):
status: New → Confirmed
milestone: ubuntu-10.04-beta-1 → none
Revision history for this message
Neil Soman (neilsoman) wrote :

Thanks for the patchset. Committed as revno 264.

Changed in eucalyptus:
status: New → Won't Fix
status: Won't Fix → Fix Committed
Changed in euca2ools (Ubuntu Lucid):
assignee: nobody → Dustin Kirkland (kirkland)
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package euca2ools - 1.2-0ubuntu5

---------------
euca2ools (1.2-0ubuntu5) lucid; urgency=low

  * Cherry pick fixes from upstream, up to bzr r265, fixes:
    - LP: #522398 - throw exceptions instead of sys.exit(1)
    - LP: #522396 - fix version string
    - LP: #523332 - check rsync return code
    - LP: #516738 - upstream fix for image store
    - LP: #525137 - don't sys.exit(1)
    - LP: #526697 - merge upstream fix for this one
    - LP: #531076 - fix euca-describe-instances against one instance
    - LP: #526591 - fix config file parsing
 -- Dustin Kirkland <email address hidden> Fri, 05 Mar 2010 16:59:25 -0600

Changed in euca2ools (Ubuntu Lucid):
status: In Progress → Fix Released
Emmet Hikory (persia)
tags: added: patch-accepted-upstream
affects: eucalyptus → euca2ools
Changed in euca2ools:
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.