本文整理汇总了Python中google3.enterprise.legacy.util.E.rmall方法的典型用法代码示例。如果您正苦于以下问题:Python E.rmall方法的具体用法?Python E.rmall怎么用?Python E.rmall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google3.enterprise.legacy.util.E
的用法示例。
在下文中一共展示了E.rmall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DeleteFiles
# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import rmall [as 别名]
def DeleteFiles(self):
# nothing to do?
if not self.default_files_var:
return 1
machines = self.config.var('MACHINES')
defaults = self.config.var(self.default_files_var)
# build a list of files from the defaults
fileParamList = []
for param in defaults.keys():
var_path = (self.base_map_var, self.name, param)
if self.config.has_var(var_path) and self.config.var(var_path) != None:
fileParamList.append(var_path)
# get a list of config dirs
dirList = self.GetDirList()
success = 1
# remove the files on all machines
for fileParam in fileParamList:
success = self.config.del_file_var_content(fileParam) and success
# remove the directories on all machines
if len(dirList) > 0:
success = E.rmall(machines, string.join(dirList, " ")) and success
return success
示例2: sanitizeMap
# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import rmall [as 别名]
def sanitizeMap(self, partition_dir, apache_dir, click_dir):
"""Sanitize the map and remove unused directories due to abandoned
collections. Note that this is a little bit expensive, so it should
not be called liberally. collect_logs cron job is the only caller
right now.
Return true if this has made some changes in the map."""
removed_dirs = {}
for dirname in self.dirnames:
partitioned_subdir = os.path.join(partition_dir, dirname)
apache_subdir = os.path.join(apache_dir, dirname)
click_subdir = os.path.join(click_dir, dirname)
if os.path.exists(partitioned_subdir) and \
not self.hasFileInSubdirs(partitioned_subdir):
E.rmall([E.LOCALHOST], partitioned_subdir)
if os.path.exists(apache_subdir) and \
not self.hasFileInSubdirs(apache_subdir):
E.rmall([E.LOCALHOST], apache_subdir)
if os.path.exists(click_subdir) and \
not self.hasFileInSubdirs(click_subdir):
E.rmall([E.LOCALHOST], click_subdir)
if not os.path.exists(apache_subdir) and \
not os.path.exists(click_subdir) and \
not os.path.exists(partitioned_subdir):
removed_dirs[dirname] = 1
logging.info("Remove directory: %s" % dirname)
for coll in self.collection_dir_map.keys():
dirlist = self.collection_dir_map[coll]
for i in range(len(dirlist) - 1, -1, -1):
if removed_dirs.has_key(dirlist[i]):
del dirlist[i]
if len(dirlist) == 0:
del self.collection_dir_map[coll]
logging.info("Remove collection: %s" % coll)
if removed_dirs:
self.changed = true
return self.changed