Permalink
Browse files

making ec2 repo tests pass

  • Loading branch information...
1 parent e2386f4 commit 4266eb1bf079aa3d2422b001a8fa1018b8a24765 BuzzTroll committed Jul 14, 2010
@@ -220,16 +220,6 @@ public String getImageLocation(Caller caller)
"request without owner hash/ID, the file(s) location is " +
"based on it");
}
- String ownerID;
- try
- {
- ownerID = this.authDB.getCanonicalUserIdFromDn(dn);
- }
- catch(AuthzDBException ex)
- {
- throw new CannotTranslateException(ex.toString(), ex);
- }
-
// todo: look at RA and construct blankspace request
//return new VMFile[]{this.getRootFile(imageID, ownerID)};
VMFile [] vma = new VMFile[1];
@@ -243,18 +233,7 @@ public String getImageLocation(Caller caller)
// look up image id
try
{
- String keyName = this.prefix + "/" + ownerID + "/" + imageID;
- int object_id = this.authDB.getFileID(keyName, this.repo_id, AuthzDBAdapter.OBJECT_TYPE_S3);
- String canUser = ownerID;
- String perms = this.authDB.getPermissions(object_id, canUser);
- int ndx = perms.indexOf('r');
- if(ndx < 0)
- {
- throw new AuthzDBException("User " + ownerID + " cannot access the image " + imageID);
- }
- String datakey = this.authDB.getDataKey(object_id);
- String urlStr = "scp://" + this.cumulusHost + ":22" + datakey;
-
+ String urlStr = getImageLocation(caller) + "/" + imageID;
file.setMountAs(this.getRootFileMountAs());
URI imageURI = new URI(urlStr);
file.setURI(imageURI);
View
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+NIMBUS_HOME_REL="`dirname $0`/.."
+NIMBUS_HOME=`cd $NIMBUS_HOME_REL; pwd`
+export NIMBUS_HOME
+
+PYTHON_EXE="/usr/bin/env python -Wignore::DeprecationWarning"
+
+NIMBUS_WEBDIR="$NIMBUS_HOME/web"
+
+NIMBUS_PYLIB="$NIMBUS_WEBDIR/lib/python"
+NIMBUS_PYSRC="$NIMBUS_WEBDIR/src/python"
+
+source $NIMBUS_HOME/cumulus/env.sh
+PYTHONPATH="${PYTHONPATH}:$NIMBUS_PYSRC:$NIMBUS_PYLIB:$PYTHONPATH:$NIMBUS_HOME/sbin:${PYTHONPATH}"
+export PYTHONPATH
+
+DJANGO_SETTINGS_MODULE="nimbusweb.portal.settings"
+export DJANGO_SETTINGS_MODULE
+
+source $NIMBUS_HOME/ve/bin/activate
+cd $NIMBUS_HOME/libexec
+nosetests ../tests/ec2_test.py
View
@@ -75,7 +75,7 @@ def test_ec2_list_upload(self):
# obviously this will not work if the default name changes
bucket = self.s3conn.get_bucket("Repo")
k = boto.s3.key.Key(bucket)
- k.key = self.cb_random_bucketname(25)
+ k.key = "VMS/" + self.can_user.get_id() + "/" + self.cb_random_bucketname(25)
k.set_contents_from_filename("/etc/group")
images = self.ec2conn.get_all_images()

0 comments on commit 4266eb1

Please sign in to comment.