Permalink
Browse files

creating the Repo bucket by directly accessing the database, thus no …

…need to start up cumulus in the install script. The Repo bucket is now owned by the public user instead of a custom user.
  • Loading branch information...
1 parent 8f0a83f commit f6dfd044488dfcdabcdbfda1f5fd6e0bf84fe568 BuzzTroll committed Jul 21, 2010
Showing with 22 additions and 42 deletions.
  1. +15 −39 cumulus/cb/pycb/tools/base_repo.py
  2. +7 −3 libexec/install-real.sh
@@ -5,61 +5,37 @@
import os
import sys
import nose.tools
-import boto
-from boto.s3.connection import OrdinaryCallingFormat
-from boto.s3.connection import VHostCallingFormat
-from boto.s3.connection import SubdomainCallingFormat
import sys
from ConfigParser import SafeConfigParser
from pycb.cumulus import *
import time
import pycb.test_common
import pynimbusauthz
+from pynimbusauthz.user import User
+from pynimbusauthz.objects import File
+from pynimbusauthz.db import DB
import unittest
import tempfile
import filecmp
-from pycb.cumulus import *
-from boto.s3.connection import OrdinaryCallingFormat
-from boto.s3.connection import S3Connection
-
-
-def setup_options(argv):
-
- u = """[options] <admin name> <repo dir>
-Create a base repository directory with public write permissions
- """
- (parser, all_opts) = pynimbusauthz.get_default_options(u)
-
- (o, args) = pynimbusauthz.parse_args(parser, all_opts, argv)
-
- if len(args) < 2:
- pynimbusauthz.parse_args(parser, all_opts, ["--help"])
-
- return (o, args)
def main(argv=sys.argv[1:]):
- (o, args) = setup_options(argv)
- # make the user that will create the dir
- id = pycb.test_common.random_string(21)
- pw = pycb.test_common.random_string(42)
- auth = pycb.config.auth
-
- display_name = args[0]
- repo_dir = args[1]
- auth.create_user(display_name, id, pw, None)
-
- print "admin s3 id is: %s" % (id)
- print "admin s3 pw: %s" % (pw)
-
- cf = OrdinaryCallingFormat()
- conn = S3Connection(id, pw, host=pycb.config.hostname, port=pycb.config.port, is_secure=pycb.config.use_https, calling_format=cf)
+ try:
+ repo_dir = argv[0]
+ con_str = pynimbusauthz.get_db_connection_string()
+ db_obj = DB(con_str=con_str)
- bucket = conn.create_bucket(repo_dir, policy='public-read-write')
-
+ user = User(db_obj, uu="CumulusPublicUser")
+ if user == None:
+ raise Exception("No public user")
+ File.create_file(db_obj, repo_dir, user, repo_dir, pynimbusauthz.alias_type_s3)
+ db_obj.commit()
+ except:
+ raise
+ return 0
if __name__ == "__main__":
rc = main()
View
@@ -41,10 +41,14 @@ echo "Creating Cumulus repository with the following commands:"
echo ""
export CUMULUS_SETTINGS_FILE=$NIMBUS_HOME/cumulus/etc/cumulus.ini
+CUMULUS_ENV="$NIMBUS_HOME/cumulus/env.sh"
+if [ ! -f $CUMULUS_ENV ]; then
+ echo "Expected file to be created: $CUMULUS_ENV"
+ exit 1
+fi
-REPOCMD1="$NIMBUS_HOME/bin/nimbusctl cumulus start"
-REPOCMD2="$NIMBUS_HOME/ve/bin/cumulus-create-repo-admin nimbusadmin@${CUMULUS_HOST} $CUMULUS_REPO_BUCKET"
-REPOCMD3="$NIMBUS_HOME/bin/nimbusctl cumulus stop"
+source $CUMULUS_ENV
+REPOCMD2="$NIMBUS_HOME/ve/bin/cumulus-create-repo-admin $CUMULUS_REPO_BUCKET"
echo " $REPOCMD1"
echo " $REPOCMD2"

0 comments on commit f6dfd04

Please sign in to comment.