CustomLog ${APACHE_LOG_DIR}/director-access.log combined ErrorLog ${APACHE_LOG_DIR}/director-error.log </VirtualHost> """ try: open('/etc/apache2/sites-available/conpaas-director.conf', 'w').write(conf) except IOError: print "W: Cannot write Apache config file. Are you root?" sys.exit(0) conflines = open(common.CONFFILE).readlines() director_url = "DIRECTOR_URL = https://%s:%s\n" % (hostname, conf_values['port']) try: num, line = [ (num, line) for num, line in enumerate(conflines) if 'DIRECTOR_URL' in line ][0] # DIRECTOR_URL already there. Update its value. conflines[num] = director_url except IndexError: # DIRECTOR_URL is not present. Add it. conflines.append(director_url) open(common.CONFFILE, 'w').writelines(conflines) db.create_all() confdir = common.config_parser.get('conpaas', 'CONF_DIR') common.chown(os.path.join(confdir, 'director.db'), 'www-data', 'www-data')
from cpsdirector.user import create_user from conpaas.core.misc import rlinput if __name__ == "__main__": db.create_all() try: email, username, password = sys.argv[1:] except ValueError: print "\nAdd new ConPaaS user" email = rlinput('E-mail: ') username = rlinput('Username: '******'Retype password: '******'Passwords do not match. Try again') password, p2 = pprompt() try: create_user(username, "", "", email, "", password, 50) except sqlalchemy.exc.IntegrityError: print "User %s already present" % username common.chown( common.config_parser.get('director', 'DATABASE_URI').replace('sqlite:///', ''), 'www-data', 'www-data')
print "Usage: %s email username password [credit=%s]" % (sys.argv[0], credit) exit(0) if len(args) == 3: email, username, password = args else: email, username, password, credit = args except ValueError: print "\nAdd new ConPaaS user" email = rlinput('E-mail: ') username = rlinput('Username: '******'Retype password: '******'Passwords do not match. Try again') password, p2 = pprompt() try: create_user(username, "", "", email, "", password, credit, "") # here we don't fill in: fname, lname, affiliation, uuid except sqlalchemy.exc.IntegrityError as e: print "User %s already present" % username print "Statement: %s" % e.statement print "Orig: %s" % e.orig print "Params: %s" % json.dumps(e.params) common.chown(common.config_parser.get('director', 'DATABASE_URI').replace('sqlite:///', ''), 'www-data', 'www-data')
ErrorLog ${APACHE_LOG_DIR}/director-error.log </VirtualHost> """ try: open('/etc/apache2/sites-available/conpaas-director', 'w').write(conf) except IOError: print "W: Cannot write Apache config file. Are you root?" sys.exit(0) conflines = open(common.CONFFILE).readlines() director_url = "DIRECTOR_URL = https://%s:%s\n" % (hostname, conf_values['port']) try: num, line = [(num, line) for num, line in enumerate(conflines) if 'DIRECTOR_URL' in line][0] # DIRECTOR_URL already there. Update its value. conflines[num] = director_url except IndexError: # DIRECTOR_URL is not present. Add it. conflines.append(director_url) open(common.CONFFILE, 'w').writelines(conflines) db.create_all() confdir = common.config_parser.get('conpaas', 'CONF_DIR') common.chown(os.path.join(confdir, 'director.db'), 'www-data', 'www-data')