def upload_config_channel(self, topdir, channel, directory_name): if not self.r.config_channel_exists(channel): die(6, "Error: config channel %s does not exist" % channel) if self.options.disable_selinux: selinux_ctx = '' else: selinux_ctx = None print "Using config channel %s" % channel channel_dir = utils.join_path(topdir, directory_name) if not os.path.exists(channel_dir): die(6, "Error: channel directory %s does not exist" % channel_dir) flist = list_files_recursive(channel_dir) for (dirname, filenames) in flist: assert dirname.startswith(channel_dir) remote_dirname = dirname[len(channel_dir):] for f in filenames: local_file = utils.join_path(dirname, f) remote_file = utils.join_path(remote_dirname, f) print "Uploading %s from %s" % (remote_file, local_file) try: self.r.put_file(channel, remote_file, local_file, is_first_revision=0, selinux_ctx = selinux_ctx) except cfg_exceptions.RepositoryFilePushError, e: log_error(e)
def run(self): log_debug(2) r = self.repository if not self.args: die(6, "No config channels specified") topdir = self.options.topdir if not topdir: die(7, "--topdir not specified") if not os.path.isdir(topdir): die(8, "--topdir specified, but `%s' not a directory" % topdir) for ns in self.args: if not r.config_channel_exists(ns): die(6, "Error: config channel %s does not exist" % ns) for file_path in r.list_files(ns): #5/11/05 wregglej - 157066 dirs_created now gets returned by get_file_info. (temp_file, info, dirs_created) = r.get_file_info(ns, file_path) dest_file = utils.join_path(topdir, ns, file_path) print "Deploying %s -> %s" % (file_path, dest_file) utils.copyfile_p(temp_file, dest_file) if info['filetype'] != 'symlink': utils.set_file_info(dest_file, info)
def run(self): log_debug(2) r = self.repository if not self.args: die(6, "No config channels specified") topdir = self.options.topdir if not topdir: die(7, "--topdir not specified") if not os.path.isdir(topdir): die(8, "--topdir specified, but `%s' not a directory" % topdir) for ns in self.args: if not r.config_channel_exists(ns): die(6, "Error: config channel %s does not exist" % ns) deploy_files(utils.join_path(topdir, ns), r, r.list_files(ns), config_channel=ns)