def __init__(self, buildout, name, options): if os.path.exists(options['storage-path']): open_file = open(options['storage-path'], 'r') options['passwd'] = open_file.read() open_file.close() if options.get('passwd', '') == '': options['passwd'] = binascii.hexlify(os.urandom( int(options.get('bytes', '24')))) return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): if os.path.exists(options['storage-path']): open_file = open(options['storage-path'], 'r') options['mac-address'] = open_file.read() open_file.close() if options.get('mac-address', '') == '': # First octet has to represent a locally administered address octet_list = [254] + [random.randint(0x00, 0xff) for x in range(5)] options['mac-address'] = ':'.join(['%02x' % x for x in octet_list]) return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): #get current slapuser name stat_info = os.stat(options['home'].strip()) options['user'] = pwd.getpwuid(stat_info.st_uid)[0] url_base = options['url-base'] project = options['project'].strip() root = options['installroot'].strip() options['home_page'] = url_base + "/" + project options['admin_page'] = url_base + "/" + project + "_ops/" options['result_page'] = url_base + "/" + project + "_result/" options['cronjob'] = os.path.join(root, project+'.cronjob') return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): pythonPath = "" for eggs in options['eggs-dirs'].splitlines(): if eggs: for item in os.listdir(eggs): path = os.path.join(eggs, item) pythonPath = path + ":" + pythonPath options['python_path'] = pythonPath options['wsgi-dir'] = os.path.join(options['site-dir'].strip(), 'apache') options['git-dir'] = os.path.join(options['site-dir'].strip(), 'git') options['svn-dir'] = os.path.join(options['site-dir'].strip(), 'svn') return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): """Default initialisation""" self.slap = slap.slap() # SLAP related information slap_connection = buildout['slap-connection'] self.computer_id = slap_connection['computer-id'] self.computer_partition_id = slap_connection['partition-id'] self.server_url = slap_connection['server-url'] self.software_release_url = slap_connection['software-release-url'] self.key_file = slap_connection.get('key-file') self.cert_file = slap_connection.get('cert-file') self.slave_list = json.loads(options['slave-instance-list']) options['slave-amount'] = '%s' % len(self.slave_list) return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): self.environ = {} self.role = '' environment_section = options.get('environment-section', '').strip() if environment_section and environment_section in buildout: # Use environment variables from the designated config section. self.environ.update(buildout[environment_section]) for variable in options.get('environment', '').splitlines(): if variable.strip(): try: key, value = variable.split('=', 1) self.environ[key.strip()] = value except ValueError: raise zc.buildout.UserError('Invalid environment variable definition: %s', variable) # Extrapolate the environment variables using values from the current # environment. for key in self.environ: self.environ[key] = self.environ[key] % os.environ return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): base_path = options['base-path'] if options.get('use-hash-url', 'True') in ['true', 'True']: pool = string.letters + string.digits hash_string = ''.join(random.choice(pool) for i in xrange(64)) path = os.path.join(base_path, hash_string) if os.path.exists(base_path): path_list = os.listdir(base_path) if len(path_list) == 1: hash_string = path_list[0] path = os.path.join(base_path, hash_string) elif len(path_list) > 1: raise ValueError("Folder %s should contain 0 or 1 element." % base_path) options['root-dir'] = path options['path'] = hash_string else: options['root-dir'] = base_path options['path'] = '' return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): base_path = options['base-path'] if options.get('use-hash-url', 'True') in ['true', 'True']: pool = string.letters + string.digits hash_string = ''.join(random.choice(pool) for i in range(64)) path = os.path.join(base_path, hash_string) if os.path.exists(base_path): path_list = os.listdir(base_path) if len(path_list) == 1: hash_string = path_list[0] path = os.path.join(base_path, hash_string) elif len(path_list) > 1: raise ValueError("Folder %s should contain 0 or 1 element." % base_path) options['root-dir'] = path options['path'] = hash_string else: options['root-dir'] = base_path options['path'] = '' return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): return GenericBaseRecipe.__init__(self, buildout, name, options)
def __init__(self, buildout, name, options): #get current uig to create a unique rpc-port for this client stat_info = os.stat(options['home'].strip()) options['rpc-port'] = pwd.getpwuid(stat_info.st_uid)[2] + 5000 return GenericBaseRecipe.__init__(self, buildout, name, options)