Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.addForbiddenPath(os.path.join(path, "tmp"))
self.addForbiddenPath(os.path.join(path, "work"))
self.addForbiddenPath(os.path.join(path, "data"))
if os.path.exists(path):
## First get everything in the conf dir
confDir = os.path.join(path, "configuration")
self.addForbiddenPath(os.path.join(confDir, 'mgmt-users.properties'))
self.addForbiddenPath(os.path.join(confDir, 'application-users.properties'))
for logFile in find("*.log", path):
self.addCopySpecLimit(logFile,
self.getOption("logsize"),
sub=(self.__jbossHome, 'JBOSSHOME'))
for xml in find("*.xml", path):
self.addCopySpec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
for prop in find("*.properties", path):
self.addCopySpec(prop, sub=(self.__jbossHome, 'JBOSSHOME'))
deployment_info = self.__get_deployment_info(confDir)
deployments = self.__get_deployments(path)
for deployment in deployments:
self.__get_listing_from_deployment(deployment, deployment_info)
for xml in find("*.xml", os.path.join(self.__jbossHome, 'modules')):
self.addCopySpec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
for dir in configDirAry:
path=os.path.join(self.__jbossHome, "server", dir)
## First add forbidden files
self.add_forbidden_path(os.path.join(path, "tmp"))
self.add_forbidden_path(os.path.join(path, "work"))
self.add_forbidden_path(os.path.join(path, "data"))
if os.path.exists(path):
## First get everything in the conf dir
confDir=os.path.join(path, "conf")
self.do_copy_file_or_dir(confDir)
## Log dir next
logDir=os.path.join(path, "log")
for logFile in find("*", logDir):
self.add_copy_spec_limit(logFile, self.get_option("logsize"))
## Deploy dir
deployDir=os.path.join(path, "deploy")
for deployFile in find("*", deployDir, max_depth=1):
self.add_copy_spec(deployFile)
## Get application deployment descriptors if designated.
if self.option_enabled("appxml"):
appxml=self.get_option("appxml")
## I'd rather use comma as the delimiter but get_option doesn't seem to be passing it through.
## Since we are using spaces as the delimiter, we need to filter out empty list elements
## if the user did something like ' all default web '.
appxml=appxml.split(' ')
## Flter(None doesn't work. Allows 0.
appxml=filter(lambda x: len(x), appxml)
for deployFile in find("*", deployDir, max_depth=1):
self.add_copy_spec(deployFile)
## Get application deployment descriptors if designated.
if self.option_enabled("appxml"):
appxml=self.get_option("appxml")
## I'd rather use comma as the delimiter but get_option doesn't seem to be passing it through.
## Since we are using spaces as the delimiter, we need to filter out empty list elements
## if the user did something like ' all default web '.
appxml=appxml.split(' ')
## Flter(None doesn't work. Allows 0.
appxml=filter(lambda x: len(x), appxml)
for app in appxml:
pat = os.path.join("*%s*" % (app,), "WEB-INF")
for file in find("*.xml", deployDir, path_pattern=pat):
self.add_copy_spec(file)
return
self.add_copy_spec_limit(logFile,
self.get_option("logsize"),
sub=(self.__jbossHome, 'JBOSSHOME'))
for xml in find("*.xml", path):
self.add_copy_spec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
for prop in find("*.properties", path):
self.add_copy_spec(prop, sub=(self.__jbossHome, 'JBOSSHOME'))
deployment_info = self.__get_deployment_info(confDir)
deployments = self.__get_deployments(path)
for deployment in deployments:
self.__get_listing_from_deployment(deployment, deployment_info)
for xml in find("*.xml", os.path.join(self.__jbossHome, 'modules')):
self.add_copy_spec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
self.add_forbidden_path(os.path.join(path, "work"))
self.add_forbidden_path(os.path.join(path, "data"))
if os.path.exists(path):
## First get everything in the conf dir
confDir=os.path.join(path, "conf")
self.do_copy_file_or_dir(confDir)
## Log dir next
logDir=os.path.join(path, "log")
for logFile in find("*", logDir):
self.add_copy_spec_limit(logFile, self.get_option("logsize"))
## Deploy dir
deployDir=os.path.join(path, "deploy")
for deployFile in find("*", deployDir, max_depth=1):
self.add_copy_spec(deployFile)
## Get application deployment descriptors if designated.
if self.option_enabled("appxml"):
appxml=self.get_option("appxml")
## I'd rather use comma as the delimiter but get_option doesn't seem to be passing it through.
## Since we are using spaces as the delimiter, we need to filter out empty list elements
## if the user did something like ' all default web '.
appxml=appxml.split(' ')
## Flter(None doesn't work. Allows 0.
appxml=filter(lambda x: len(x), appxml)
for app in appxml:
pat = os.path.join("*%s*" % (app,), "WEB-INF")
for file in find("*.xml", deployDir, path_pattern=pat):
self.add_copy_spec(file)
return
def __get_deployments(self, path):
return list(chain(
find("*", os.path.join(path, "deployments")),
find("content", path)))
path=os.path.join(self.__jbossHome, "server", dir)
## Really annoying that there appears to be no vehicle to
## say I want ignore case...argh!
self.do_file_sub(os.path.join(path,"conf","login-config.xml"),
r"\"[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]\".*>.*",
r'"password">********')
tmp = os.path.join(path,"conf", "props")
for propFile in find("*-users.properties", tmp):
self.do_file_sub(propFile,
r"=(.*)",
r'=********')
## Remove PW from -ds.xml files
tmp=os.path.join(path, "deploy")
for dsFile in find("*-ds.xml", tmp):
self.do_file_sub(dsFile,
r"<[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>.*",
r"********")
return
def __get_deployments(self, path):
return list(chain(
find("*", os.path.join(path, "deployments")),
find("content", path)))
for dir_ in self.__jbossServerConfigDirs:
path = os.path.join(self.__jbossHome, dir_)
self.doRegexSub(os.path.join(path,"configuration","*.xml"),
password_xml_regex,
r'********')
tmp = os.path.join(path,"configuration")
for propFile in find("*-users.properties", tmp):
self.doRegexSub(propFile,
r"=(.*)",
r'=********')
# Remove PW from -ds.xml files
tmp = os.path.join(path, "deployments")
for dsFile in find("*-ds.xml", tmp):
self.doRegexSub(dsFile,
password_xml_regex,
r"********")