def add_header(fn, contents): lines = list() if not fn: fn = "???" lines.append("# Adjusted source file %s" % (fn.strip())) lines.append("# On %s" % (date.rcf8222date())) lines.append("# By user %s, group %s" % (sh.getuser(), sh.getgroupname())) lines.append("") if contents: lines.append(contents) return joinlinesep(*lines)
def add_header(fn, contents, adjusted=True): lines = [] if not fn: fn = "???" if adjusted: lines.append('# Adjusted source file %s' % (fn.strip())) else: lines.append('# Created source file %s' % (fn.strip())) lines.append("# On %s" % (iso8601())) lines.append("# By user %s, group %s" % (sh.getuser(), sh.getgroupname())) lines.append("") if contents: lines.append(contents) return joinlinesep(*lines)
def _get_param_map(self, config_fn): data_dir = sh.joinpths(self.get_option("app_dir"), self.cfg.getdefaulted("swift", "data_location", "data")) cfg_dir = self.get_option("cfg_dir") log_dir = sh.joinpths(data_dir, LOG_DIR) return { "USER": self.cfg.getdefaulted("swift", "swift_user", sh.getuser()), "GROUP": self.cfg.getdefaulted("swift", "swift_group", sh.getgroupname()), "SWIFT_DATA_LOCATION": data_dir, "SWIFT_CONFIG_LOCATION": cfg_dir, "SERVICE_TOKEN": self.cfg.get("passwords", "service_token"), "AUTH_SERVER": AUTH_SERVICE, "SWIFT_HASH": self.cfg.get("passwords", "swift_hash"), "SWIFT_LOGDIR": log_dir, "SWIFT_PARTITION_POWER_SIZE": self.cfg.getdefaulted("swift", "partition_power_size", "9"), # Note: leave these alone, will be adjusted later "NODE_PATH": "%NODE_PATH%", "BIND_PORT": "%BIND_PORT%", "LOG_FACILITY": "%LOG_FACILITY%", }
def _get_apache_user_group(self): user = self.cfg.getdefaulted('horizon', 'apache_user', sh.getuser()) group = self.cfg.getdefaulted('horizon', 'apache_group', sh.getgroupname()) return (user, group)