コード例 #1
0
 def enumerate_path(self):
     return list({
         *utils.whereis("hadoop"),
         "/usr/local/cellar/hadoop/3.2.1/libexec/etc/hadoop/",  # homebrew
         "/local/hadoop/etc/hadoop",  # apt,
         "/etc/hadoop",  # apt
     })
コード例 #2
0
ファイル: redis.py プロジェクト: shouc/daudit
 def enumerate_path(self):
     return list({
         *utils.whereis("redis"),
         "/etc/redis/", # apt & yum
         "/usr/local/etc/", # homebrew
         "/etc/", # yum
     })
コード例 #3
0
class uClientNewStatic(utils.QtileTests):
    config = ClientNewStaticConfig()

    def test_minimal(self):
        a = self.testWindow("one")
        self.kill(a)

    if utils.whereis("gkrellm"):

        def test_gkrellm(self):
            self.testGkrellm()
            time.sleep(0.1)
コード例 #4
0
def export_hive_to_file(hive_command, parameters = None, type = 'csv', outputname = None, ftpuser = '******', compress = True):
	#Create ftpuser if user does not already exist in the system
	#Default user information and password
	modifiedUser = ftpuser
	md5pass = '******'
	if ftpuser is not 'ftpsecure':
		modifiedUser, md5pass = systemUser.add(ftpuser)
		print modifiedUser, md5pass
	#Check outputname, if None then enter default value
	outputpath = "/home/" + modifiedUser + "/" + type + "/"
	if outputname is None:
		outputname = time.strftime("%Y%m%d%H%M%S", time.localtime())
	outputname = outputname + "." + type 
	#Check if 'hive' program exist on this system and assign the full path to location
	location = utils.whereis('hive')
	if location is not None:
		process = subprocess.Popen(['hive','-e',hive_command], shell=False, stdout=subprocess.PIPE)
		FILE = open(outputpath+outputname,"w")
		FILE.writelines(parameters + "\n")
		for line in process.stdout.xreadlines():
			FILE.writelines(line.replace('\N',''))
		FILE.close()
		process.poll()
		rtnCode = process.returncode
		if rtnCode is None:
			counter = 0
			while rtnCode is None or counter == 1000:
				process.poll()
				rtnCode = process.returncode
				counter += 1
			if counter == 1000:
				rtnCode = 7
		if int(rtnCode) == 0:
			print "Export Successfully Finished."
			if compress:
				process = subprocess.Popen(['zip', '-j', outputpath + outputname + '.zip',outputpath + outputname], shell=False, stdout=subprocess.PIPE)
				outputname = outputname + ".zip"
				print "File available: " + outputpath + outputname
			else:
				print "File available: " + outputpath + outputname
		else:
			print "Error: Return Code (" + str(rtnCode) + ")"
			raise NameError("Export Report was Unsuccessfull with Error Code: " + str(rtnCode) + ". Please forward this error to an administrator")
	else:
		#Raise Error
		raise NameError("Command 'hive' was not found anywhere on the system Path. Please make sure you are running export_report.py from the Master Node")
	return outputpath, outputname, modifiedUser, md5pass
コード例 #5
0
ファイル: spark.py プロジェクト: shouc/daudit
 def enumerate_path(self):
     return list({
         *utils.whereis("spark"),
         "/local/spark/etc/spark",  # apt,
         "/etc/spark",  # apt
     })
コード例 #6
0
class ClientNewStaticConfig(_Config):
    @staticmethod
    def main(c):
        def client_new(c):
            c.static(0)

        libqtile.hook.subscribe.client_new(client_new)


@Xephyr(False, ClientNewStaticConfig())
def test_minimal_(self):
    a = self.testWindow("one")
    self.kill(a)


if utils.whereis("gkrellm"):

    @Xephyr(False, ClientNewStaticConfig())
    def test_gkrellm(self):
        self.testGkrellm()
        time.sleep(0.1)


class ToGroupConfig(_Config):
    @staticmethod
    def main(c):
        def client_new(c):
            c.togroup("d")

        libqtile.hook.subscribe.client_new(client_new)
コード例 #7
0
import os, sys
import subprocess
from xml.etree.ElementTree import ElementTree, SubElement, Element
import logging
from optparse import OptionParser
from utils import get_or_create_path, whereis

logger = logging.getLogger('rawbracket')
hdlr = logging.FileHandler('rawbracket.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)

EXP = "Exposure"
UFRAW_BATCH = whereis('ufraw-batch')

ufrawrc = os.path.expanduser("~/.ufrawrc")
logger.info("reading %s" % (ufrawrc))
tree = ElementTree()
tree.parse(ufrawrc)
ufraw = tree.getroot()

exposure = tree.find(EXP)
if exposure is not None:
    ev = float(exposure.text)
else:
    ev = 0.0
    exposure = SubElement(ufraw, EXP)

def get_ufraw_conf(ufrawrc):
コード例 #8
0
ファイル: test_manager.py プロジェクト: AdamG/qtile
class ClientNewStaticConfig(_Config):
    @staticmethod
    def main(c):
        import libqtile.hook

        def client_new(c):
            c.static(0)
        libqtile.hook.subscribe.client_new(client_new)


@Xephyr(False, ClientNewStaticConfig())
def test_minimal_(self):
    a = self.testWindow("one")
    self.kill(a)

if utils.whereis("gkrellm"):
    @Xephyr(False, ClientNewStaticConfig())
    def test_gkrellm(self):
        self.testGkrellm()
        time.sleep(0.1)


class ToGroupConfig(_Config):
    @staticmethod
    def main(c):
        import libqtile.hook

        def client_new(c):
            c.togroup("d")
        libqtile.hook.subscribe.client_new(client_new)