rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
os.system('tar xzf ../data/pulse2-image-sample.tar.gz -C /var/lib/pulse2/imaging/masters/' + self.IMAGE_UUID) result = SERVER.imageDone('00:11:22:33:44:ff', self.IMAGE_UUID)
os.system('tar xzf ../data/pulse2-image-sample.tar.gz -C /var/lib/pulse2/imaging/masters/' + IMAGE_UUID) result = SERVER.imageDone('00:11:22:33:44:ff', IMAGE_UUID)
def test_08imageDone(self): """ Tell that the image is done """ # Put a sample image os.system('tar xzf ../data/pulse2-image-sample.tar.gz -C /var/lib/pulse2/imaging/masters/' + self.IMAGE_UUID) result = SERVER.imageDone('00:11:22:33:44:ff', self.IMAGE_UUID) self.assertTrue(result)
result = SERVER.imagingServerISOCreate(self.IMAGE_UUID, 650 * 1024 * 1024, title)
result = SERVER.imagingServerISOCreate(IMAGE_UUID, 650 * 1024 * 1024, title)
def test_09generateISO(self): """ Check ISO generation """ title = "Image ISO" result = SERVER.imagingServerISOCreate(self.IMAGE_UUID, 650 * 1024 * 1024, title) self.assertTrue(result) # Check that we have an ISO file ret = False for _ in range(10): if os.path.exists(os.path.join('/var/lib/pulse2/imaging/isos', title +...
result = SERVER.computerUnregister('UUID2', [self.IMAGE_UUID], True)
result = SERVER.computerUnregister('UUID2', [IMAGE_UUID], True)
def test_10computerUnregister(self): """ Check computer archival """ result = SERVER.computerUnregister('UUID4', [], False) self.assertTrue(result) # Wait for the archival background process to be done sleep(5) # No archival done self.assertFalse(os.path.exists('/var/lib/pulse2/imaging/archives/UUID4-1')) # Computer di...
self.logger.warn("can load the apropriate backend for your version of glpi")
self.logger.warn("Can't load the right database backend for your version of GLPI")
def activate(self, conffile = None): self.logger = logging.getLogger()
q = q.select_from(self.image.join(self.image_on_imaging_server).join(self.imaging_server).join(self.entity).join(self.target, self.target.c.fk_entity == self.entity.c.id).join(self.mastered_on, self.mastered_on.c.fk_image == self.image.c.id).join(self.imaging_log, self.imaging_log.c.id == self.mastered_on.c.fk_imaging_...
q = q.select_from( self.image.\ join(self.image_state).\ join(self.image_on_imaging_server).\ join(self.imaging_server).\ join(self.entity).\ join(self.target, self.target.c.fk_entity == self.entity.c.id).\ join(self.mastered_on, self.mastered_on.c.fk_image == self.image.c.id).\ join(self.imaging_log, self.imaging_log....
def __PossibleImages(self, session, target_uuid, is_master, filt): q = session.query(Image).add_column(self.image.c.id) q = q.select_from(self.image.join(self.image_on_imaging_server).join(self.imaging_server).join(self.entity).join(self.target, self.target.c.fk_entity == self.entity.c.id).join(self.mastered_on, self.m...
q = q.filter(or_(self.image.c.desc.like('%'+filt+'%'), self.image.c.name.like('%'+filt+'%')))
q = q.filter(or_(self.image.c.desc.like('%%%s%%' % filt), self.image.c.name.like('%%%s%%' % filt)))
def __PossibleImages(self, session, target_uuid, is_master, filt): q = session.query(Image).add_column(self.image.c.id) q = q.select_from(self.image.join(self.image_on_imaging_server).join(self.imaging_server).join(self.entity).join(self.target, self.target.c.fk_entity == self.entity.c.id).join(self.mastered_on, self.m...
if in_profile.has_key(i.id):
if i.id in in_profile:
def getPossibleImagesOrMaster(self, target_uuid, target_type, is_master, start, end, filt): session = create_session() menu = self.getTargetsMenuTUUID(target_uuid) q1 = self.__PossibleImages(session, target_uuid, is_master, filt) q1 = q1.group_by(self.image.c.id) if end != -1: q1 = q1.offset(int(start)).limit(int(end)-...
self.logger.error('WOOT : %s' % "a")
def registerImage(self, imaging_server_uuid, computer_uuid, params): """ Registers an image into the database, and link it to a package server and to a computer.
to_be_exported = ['id', 'path', 'checksum', 'size', 'desc', 'is_master', 'creation_date', 'fk_creator', 'name', 'is_local', 'uuid', 'mastered_on_target_uuid', 'read_only']
to_be_exported = ['id', 'path', 'checksum', 'size', 'desc', 'is_master', 'creation_date', 'fk_creator', 'name', 'is_local', 'uuid', 'mastered_on_target_uuid', 'read_only', 'fk_state']
def toH(self, level = 0): ImagingDatabase().completeNomenclatureLabel(self) ret = database_helper.DBObject.toH(self, level) if hasattr(self, 'id'): ret['imaging_uuid'] = self.getUUID() return ret
ldapUserGroupControl().delGroup(cngroup)
return ldapUserGroupControl().delGroup(cngroup)
def delGroup(cngroup): ldapUserGroupControl().delGroup(cngroup)
r = AF().log(PLUGIN_NAME, AA.BASE_DEL_GROUP, [(groupdn, AT.GROUP)]) self.l.delete_s(groupdn) r.commit()
result = self.l.search_s(groupdn, ldap.SCOPE_BASE) c, attrs = result[0] gid = attrs['gidNumber'][0] result = self.l.search_s(self.baseUsersDN, ldap.SCOPE_SUBTREE, 'gidNumber=' + gid) if len(result) > 0: return 2 else: r = AF().log(PLUGIN_NAME, AA.BASE_DEL_GROUP, [(groupdn, AT.GROUP)]) self.l.delete_s(groupdn) r.commit...
def delGroup(self, group): """ Remove a group /!\ baseGroupsDN based on INI file
shutil.rmtree(path)
if os.path.exists(path): shutil.rmtree(path) else: logger = logging.getLogger() logger.error('The "%s" share path does not exist.' % path)
def delShare(self, name, remove): """ Delete a share from SAMBA configuration, and maybe delete the share directory from disk. The save method must be called to update smb.conf.
self.update_image = os.path.join( self.get_uuid,
self.get_uuid = os.path.join( self.hooks_dir,
def setup(self, config_file): """ Setup config object according to config_file content. """
logger.info("support.mmctools.launch(\""+str(cmd)+","+str(param)+"\")")
logger.debug("support.mmctools.launch(\""+str(cmd)+","+str(param)+"\")")
def launch(cmd, param): logger = logging.getLogger() logger.info("support.mmctools.launch(\""+str(cmd)+","+str(param)+"\")") shProcess = shProcessProtocol(cmd) logger = logging.getLogger() reactor.spawnProcess(shProcess, cmd, param,os.environ) while not shProcess.done: reactor.iterate() if shProcess.exitCode != 0: #if ...
result = client.inventory.inventoryExists('UUID5')
result = client.inventory.inventoryExists('UUID3')
def test101inventoryInject(self): OCS = '/usr/sbin/ocsinventory-agent' if not os.path.exists(OCS): print "OCS Inventory Agent is not installed, skipping test" sys.exit(0) # Launch the inventory agent to report an inventory os.system(OCS + ' --server=http://127.0.0.1:9999') time.sleep(20) result = client.inventory.inven...
result = client.inventory.inventoryExists('UUID6')
result = client.inventory.inventoryExists('UUID4')
def test104ubuntuInject(self): """ Inject an Ubuntu UTF-8 inventory containing latin-1 chars """ os.system('gunzip -c ../data/ocs-ubuntu-10.04-lts.xml.gz | $PULSE2/services/contrib/Ocsinventory_local.pl -u http://127.0.0.1:9999 --stdin') time.sleep(20) result = client.inventory.inventoryExists('UUID6') self.assertTrue(...
result = client.inventory.inventoryExists('UUID7')
result = client.inventory.inventoryExists('UUID5')
def test104macosxInject(self): """ Inject a MAC OS X inventory """ os.system('gunzip -c ../data/ocs-os-x-10.4.xml.gz | $PULSE2/services/contrib/Ocsinventory_local.pl -u http://127.0.0.1:9999 --stdin') time.sleep(20) result = client.inventory.inventoryExists('UUID7') self.assertTrue(result)
self.log.info("Writing my UUID Cache File %s" % (self.cachePath))
self.log.debug("Writing my UUID Cache File %s" % (self.cachePath))
def _flush(self): """ Update cache file using our memory stucture """ try: self.log.info("Writing my UUID Cache File %s" % (self.cachePath)) fp = open(self.cachePath, 'wb') self.config.write(fp) fp.close() except Exception, e: self.log.warn("Can't write my UUID Cache File %s : %s" % (self.cachePath, e)) return False re...
def unique(s): """Return a list of the elements in s, but without duplicates. For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], unique("abcabc") some permutation of ["a", "b", "c"], and unique(([1, 2], [2, 3], [1, 2])) some permutation of [[2, 3], [1, 2]]. For best speed, all sequence elements should...
def unique(s): """Return a list of the elements in s, but without duplicates. For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], unique("abcabc") some permutation of ["a", "b", "c"], and unique(([1, 2], [2, 3], [1, 2])) some permutation of [[2, 3], [1, 2]]. For best speed, all sequence elements should...
rpc_loop_timer = os.path.join(base_folder, self.cp.getint('imaging_api', 'rpc_loop_timer'))
rpc_loop_timer = self.cp.getint('imaging_api', 'rpc_loop_timer')
def setup(self, config_file): if self.cp == None: # Load configuration file if sys.platform != "win32": self.cp = Pulse2ConfigParser() else: self.cp = ConfigParser.ConfigParser() self.cp.read(config_file)
rpc_count = os.path.join(base_folder, self.cp.getint('imaging_api', 'rpc_loop_timer'))
rpc_count = self.cp.getint('imaging_api', 'rpc_count')
def setup(self, config_file): if self.cp == None: # Load configuration file if sys.platform != "win32": self.cp = Pulse2ConfigParser() else: self.cp = ConfigParser.ConfigParser() self.cp.read(config_file)
rpc_interval = os.path.join(base_folder, self.cp.getint('imaging_api', 'rpc_interval'))
rpc_interval = self.cp.getint('imaging_api', 'rpc_interval')
def setup(self, config_file): if self.cp == None: # Load configuration file if sys.platform != "win32": self.cp = Pulse2ConfigParser() else: self.cp = ConfigParser.ConfigParser() self.cp.read(config_file)
self.l.add_s(dn, addModlist(data))
self.l.add_s(dn, ldap.modlist.addModlist(data))
def addComputer(self, ctx, params): """ Add a computer in the main computer list
except NoSectionError, NoOptionError: self.logfile = logfile
except (NoSectionError, NoOptionError): self.logfile = logfile
def __init__(self, logfile = '/var/log/ldap.log', pattern=None): config = PluginConfig("base") try: self.logfile = config.get("ldap", "logfile") except NoSectionError, NoOptionError: self.logfile = logfile try: self.maxElt = config.get("LogView", "maxElt") except NoSectionError, NoOptionError: self.maxElt= 200 if patte...
except NoSectionError, NoOptionError: self.maxElt= 200
except (NoSectionError, NoOptionError): self.maxElt= 200
def __init__(self, logfile = '/var/log/ldap.log', pattern=None): config = PluginConfig("base") try: self.logfile = config.get("ldap", "logfile") except NoSectionError, NoOptionError: self.logfile = logfile try: self.maxElt = config.get("LogView", "maxElt") except NoSectionError, NoOptionError: self.maxElt= 200 if patte...
self.log.warn("Can't create my UUID Cache File %s " % self.cachePath)
self.log.warn("Can't create my UUID Cache File %s : %s" % (self.cachePath, e))
def __init__(self): if not os.path.isfile(self.cachePath): try: fd = open(self.cachePath, 'wb') fd.close() except Exception, e: self.log.warn("Can't create my UUID Cache File %s " % self.cachePath) return False self.config.read(self.cachePath)
self.log.warn("Can't create my UUID Cache File %s " % cachePath)
self.log.warn("Can't create my UUID Cache File %s : %s" % (self.cachePath, e))
def _flush(self): # update cache file using our memory stucture try: fd = open(self.cachePath, 'wb') self.config.write(fd) fd.close() except Exception, e: self.log.warn("Can't create my UUID Cache File %s " % cachePath) return False
Get a computer UUID using the MAC Adress
Get a computer UUID using the MAC Address
def getComputerByMac(self, MACAddress): """ Get a computer UUID using the MAC Adress """ d = self.callRemote("getComputerByMac", MACAddress) d.addErrback(self.onErrorRaise, "Imaging:getComputerByMac", MACAddress) return d
def logClientAction(self, mac, level, phase, message): """ Get a computer UUID using the MAC Address """ d = self.callRemote("logClientAction", mac, level, phase, message) d.addErrback(self.onErrorRaise, "Imaging:logClientAction", mac, level, phase, message) return d
def logClientAction(self, uuid, level, phase, message): """ Log action done by uuid """ d = self.callRemote("logClientAction", uuid, level, phase, message) d.addErrback(self.onErrorRaise, "Imaging:logClientAction", uuid, level, phase, message) return d def imageRegister(self, computer_uuid, image_uuid): """ Declare a...
def logClientAction(self, mac, level, phase, message): """ Get a computer UUID using the MAC Address """ d = self.callRemote("logClientAction", mac, level, phase, message) d.addErrback(self.onErrorRaise, "Imaging:logClientAction", mac, level, phase, message) return d
gid = ldapobj.getDetailedGroup(group)['gidNumber'][0]
gid = ldapObj.getDetailedGroup(group)['gidNumber'][0]
def delGroup(self, group): """ Remove a group /!\ baseGroupsDN based on INI file
q = session.query(Menu).filter(and_(self.entity.c.fk_default_menu == self.menu.c.id, self.entity.c.uuid == loc_id)).first()
q = session.query(Menu).\ select_from( self.menu.join(self.imaging_server, self.imaging_server.c.fk_default_menu == self.menu.c.id).\ join(self.entity)).\ filter(self.entity.c.uuid == loc_id).\ first()
def getEntityDefaultMenu(self, loc_id, session = None): need_to_close_session = False if session == None: need_to_close_session = True session = create_session() q = session.query(Menu).filter(and_(self.entity.c.fk_default_menu == self.menu.c.id, self.entity.c.uuid == loc_id)).first() # there should always be only one!...
filename = os.path.join(self.config.imaging_api['bootmenus_folder'], pulse2.utils.reduceMACAddress(self.mac))
filename = os.path.join(self.config.imaging_api['base_folder'], self.config.imaging_api['bootmenus_folder'], pulse2.utils.reduceMACAddress(self.mac))
def write(self): """ write the client menu """ buf = self.buildMenu() filename = os.path.join(self.config.imaging_api['bootmenus_folder'], pulse2.utils.reduceMACAddress(self.mac))
fid, tempname = tempfile.mkstemp(dir=self.config.imaging_api['bootmenus_folder'])
fid, tempname = tempfile.mkstemp(dir = os.path.join(self.config.imaging_api['base_folder'], self.config.imaging_api['bootmenus_folder']))
def write(self): """ write the client menu """ buf = self.buildMenu() filename = os.path.join(self.config.imaging_api['bootmenus_folder'], pulse2.utils.reduceMACAddress(self.mac))
if return_val != 0:
if return_var != 0:
def rename(self, new_name): # * Test if name exist if not self.file_exist: self.error_code = errors.ERROR_DELETE_FILE return False
self.errcode = ERR_UNKNOWN
self.errcode = ERROR_UNKOWN
def MSC_fileSend(session, path): if session.platform == "Windows": path = MSC_cygpath(path, "WinToCyg", "", 1) p1 = re.compile(' ') path = p1.sub('\\ ', path) cmd = "scp %s %s@%s:\"%s/%s\"" % ( _FILES['send_filename']['tmp_name'], session.user, session.ip, path, os.path.basename(_FILES['send_filename']['name']) ) ses...
self.logger.debug('Writing boot menu for computer MAC %s' % self.mac)
filename = os.path.join(self.config.imaging_api['base_folder'], self.config.imaging_api['bootmenus_folder'], pulse2.utils.reduceMACAddress(self.mac)) self.logger.debug('Preparing to write boot menu for computer MAC %s into file %s' % (self.mac, filename))
def write(self): """ write the client menu """ self.logger.debug('Writing boot menu for computer MAC %s' % self.mac) buf = self.buildMenu() filename = os.path.join(self.config.imaging_api['base_folder'], self.config.imaging_api['bootmenus_folder'], pulse2.utils.reduceMACAddress(self.mac))
filename = os.path.join(self.config.imaging_api['base_folder'], self.config.imaging_api['bootmenus_folder'], pulse2.utils.reduceMACAddress(self.mac))
def write(self): """ write the client menu """ self.logger.debug('Writing boot menu for computer MAC %s' % self.mac) buf = self.buildMenu() filename = os.path.join(self.config.imaging_api['base_folder'], self.config.imaging_api['bootmenus_folder'], pulse2.utils.reduceMACAddress(self.mac))
def endBack(when):
def endBack(when = None):
def endBack(when): """ take the reactor down """ if when == "timeout" : logging.getLogger().error('HOOK %s : Killed by a timeout' % sys.argv[0]) twisted.internet.reactor.callLater(0, twisted.internet.reactor.stop)
ret[part] = self.getLastMachineInventoryPart(ctx, part, params)
if part != 'Entity': ret[part] = self.getLastMachineInventoryPart(ctx, part, params)
def getLastMachineInventoryFull(self, ctx, params): """ Return the full and last inventory of a machine
dl = defer.DeferredList(ds)
dl = twisted.internet.defer.DeferredList(ds)
def onErrorGetPackageDetailCall(self, error, pids, value = []): # when the package server is old, this one call function does not exists # so we call several time the existing function self.logger.warn("one of your package server does not support getPackagesDetail, you should update it.") ds = [] for pid in pids: d = s...
logger.info("Delete Single quota")
logger.debug("Delete Single quota")
def deleteDiskQuota(self, uid, device, single=True): logger = logging.getLogger()
logger.info("Network Quota:" + ldapquota)
logger.debug("Network Quota:" + ldapquota)
def setNetworkQuota(self, uid, network, quota, overwrite = "all"): logger = logging.getLogger() ldapquota = '%s,%s' % (network, str(int(quota) * 1048576)) logger.info("Network Quota:" + ldapquota) if not self.hasDiskQuotaObjectClass(uid): self.addDiskQuotaObjectClass(uid) # @todo, fix copy from disk quotas. try: userd...
logger.info("Current network quota sizes: " + str(self.convertNetworkQuotaToMB(x))) logger.info("Requested quota size: " + quota) logger.info("Overwrite mode: " + overwrite)
logger.debug("Current network quota sizes: " + str(self.convertNetworkQuotaToMB(x))) logger.debug("Requested quota size: " + quota) logger.debug("Overwrite mode: " + overwrite)
def setNetworkQuota(self, uid, network, quota, overwrite = "all"): logger = logging.getLogger() ldapquota = '%s,%s' % (network, str(int(quota) * 1048576)) logger.info("Network Quota:" + ldapquota) if not self.hasDiskQuotaObjectClass(uid): self.addDiskQuotaObjectClass(uid) # @todo, fix copy from disk quotas. try: userd...
logger.info('No overwrite mode set. so not overwriting.')
logger.debug('No overwrite mode set. so not overwriting.')
def setNetworkQuota(self, uid, network, quota, overwrite = "all"): logger = logging.getLogger() ldapquota = '%s,%s' % (network, str(int(quota) * 1048576)) logger.info("Network Quota:" + ldapquota) if not self.hasDiskQuotaObjectClass(uid): self.addDiskQuotaObjectClass(uid) # @todo, fix copy from disk quotas. try: userd...
logger.info('Current network quota is bigger than new quota, so not overwriting')
logger.debug('Current network quota is bigger than new quota, so not overwriting')
def setNetworkQuota(self, uid, network, quota, overwrite = "all"): logger = logging.getLogger() ldapquota = '%s,%s' % (network, str(int(quota) * 1048576)) logger.info("Network Quota:" + ldapquota) if not self.hasDiskQuotaObjectClass(uid): self.addDiskQuotaObjectClass(uid) # @todo, fix copy from disk quotas. try: userd...
logger.info('Current network quota is smaller than new quota, so not overwriting')
logger.debug('Current network quota is smaller than new quota, so not overwriting')
def setNetworkQuota(self, uid, network, quota, overwrite = "all"): logger = logging.getLogger() ldapquota = '%s,%s' % (network, str(int(quota) * 1048576)) logger.info("Network Quota:" + ldapquota) if not self.hasDiskQuotaObjectClass(uid): self.addDiskQuotaObjectClass(uid) # @todo, fix copy from disk quotas. try: userd...
logger.info("received quota for " + uid + ", device: " + device + ", size: " + quota)
logger.debug("received quota for " + uid + ", device: " + device + ", size: " + quota)
def setDiskQuota(self, uid, device, quota, overwrite = "all",single = True): logger = logging.getLogger() logger.info("received quota for " + uid + ", device: " + device + ", size: " + quota) blocks = self.convertMBtoBlocks(quota, device); softblocks = int (blocks * self.configuserquota.softquotablocks) inodes = int(bl...
logger.info("Quota for: " + uid + " - " + ldapquota)
logger.debug("Quota for: " + uid + " - " + ldapquota)
def setDiskQuota(self, uid, device, quota, overwrite = "all",single = True): logger = logging.getLogger() logger.info("received quota for " + uid + ", device: " + device + ", size: " + quota) blocks = self.convertMBtoBlocks(quota, device); softblocks = int (blocks * self.configuserquota.softquotablocks) inodes = int(bl...
logger.info("Current network quota sizes: " + str(self.convertDiskQuotaToMB(x))) logger.info("Requested quota size: " + quota) logger.info("Overwrite mode: " + overwrite)
logger.debug("Current network quota sizes: " + str(self.convertDiskQuotaToMB(x))) logger.debug("Requested quota size: " + quota) logger.debug("Overwrite mode: " + overwrite)
def setDiskQuota(self, uid, device, quota, overwrite = "all",single = True): logger = logging.getLogger() logger.info("received quota for " + uid + ", device: " + device + ", size: " + quota) blocks = self.convertMBtoBlocks(quota, device); softblocks = int (blocks * self.configuserquota.softquotablocks) inodes = int(bl...
logger.info('Current quota is bigger than new quota, so not overwriting')
logger.debug('Current quota is bigger than new quota, so not overwriting')
def setDiskQuota(self, uid, device, quota, overwrite = "all",single = True): logger = logging.getLogger() logger.info("received quota for " + uid + ", device: " + device + ", size: " + quota) blocks = self.convertMBtoBlocks(quota, device); softblocks = int (blocks * self.configuserquota.softquotablocks) inodes = int(bl...
logger.info('Current quota is smaller than new quota, so not overwriting')
logger.debug('Current quota is smaller than new quota, so not overwriting')
def setDiskQuota(self, uid, device, quota, overwrite = "all",single = True): logger = logging.getLogger() logger.info("received quota for " + uid + ", device: " + device + ", size: " + quota) blocks = self.convertMBtoBlocks(quota, device); softblocks = int (blocks * self.configuserquota.softquotablocks) inodes = int(bl...
logger.info("Temp file: %s" % (self.tempfilename))
logger.debug("Temp file: %s" % (self.tempfilename))
def appendQuotatasks(self, uid, blocks, softblocks, inodes, softinodes, devicepath): logger = logging.getLogger() if not self.tempfilename: self.tempfilename = tempfile.mktemp() logger.info("Temp file: %s" % (self.tempfilename)) s = Template(self.configuserquota.setquotascript) shellscript = s.substitute(uid=uid, blo...
logger.info("Append SetQuotaScript: " + shellscript);
logger.debug("Append SetQuotaScript: " + shellscript);
def appendQuotatasks(self, uid, blocks, softblocks, inodes, softinodes, devicepath): logger = logging.getLogger() if not self.tempfilename: self.tempfilename = tempfile.mktemp() logger.info("Temp file: %s" % (self.tempfilename)) s = Template(self.configuserquota.setquotascript) shellscript = s.substitute(uid=uid, blo...
logger.info("ApplyQuotas: " + shellscript);
logger.debug("ApplyQuotas: " + shellscript);
def applyQuotaToFS(self): if not self.tempfilename: return logger = logging.getLogger() shellscript = "%s %s" % (self.configuserquota.runquotascript, self.tempfilename) logger.info("ApplyQuotas: " + shellscript); def cb(shprocess): # The callback just return the process outputs # if shprocess.exitCode != 0: logger.erro...
logger.info("shell result:" + shprocess.out)
logger.debug("shell result:" + shprocess.out)
def cb(shprocess): # The callback just return the process outputs # if shprocess.exitCode != 0: logger.error("Error applying quotas: " + shprocess.err) logger.info("shell result:" + shprocess.out) logger.error("See: " + self.tempfilename + " for details of the commands run") else: os.remove(self.tempfilename) self.tem...
logger.info("Temp file: %s" % (self.tempdelfilename))
logger.debug("Temp file: %s" % (self.tempdelfilename))
def appendDeleteQuotatasks(self, uid, devicepath): logger = logging.getLogger() if not self.tempdelfilename: self.tempdelfilename = tempfile.mktemp() logger.info("Temp file: %s" % (self.tempdelfilename)) s = Template(self.configuserquota.delquotascript) shellscript = s.substitute(uid=uid, devicepath=devicepath) logger...
logger.info("Append DelQuotaScript: " + shellscript);
logger.debug("Append DelQuotaScript: " + shellscript);
def appendDeleteQuotatasks(self, uid, devicepath): logger = logging.getLogger() if not self.tempdelfilename: self.tempdelfilename = tempfile.mktemp() logger.info("Temp file: %s" % (self.tempdelfilename)) s = Template(self.configuserquota.delquotascript) shellscript = s.substitute(uid=uid, devicepath=devicepath) logger...
logger.info("DelQuotaScript: " + shellscript);
logger.debug("DelQuotaScript: " + shellscript);
def deleteQuotaOnFS(self): if not self.tempdelfilename: return logger = logging.getLogger() shellscript = "%s %s" % (self.configuserquota.runquotascript, self.tempfilename) logger.info("DelQuotaScript: " + shellscript); def cb(shprocess): # The callback just return the process outputs if shprocess.exitCode != 0: logger...
logger.info("shell result:" + shprocess.out)
logger.debug("shell result:" + shprocess.out)
def cb(shprocess): # The callback just return the process outputs if shprocess.exitCode != 0: logger.error("Error applying del quotas: " + shprocess.err) logger.info("shell result:" + shprocess.out) logger.error("See: " + self.tempfilename + " for details of the commands run") else: os.remove(self.tempdelfilename) sel...
logger.info("Del object class")
logger.debug("Del object class")
def delQuotaObjectClass(self, uid): """ Return true if the objectClass is removed. @return: return True if the object class is able to be removed @rtype: boolean """ logger = logging.getLogger() user = self.getDetailedUser(uid) logger.info("Del object class") if "quota" in user.keys() or "networkquota" in user.keys()...
logger.info("Del object class removal")
logger.debug("Del object class removal")
def delQuotaObjectClass(self, uid): """ Return true if the objectClass is removed. @return: return True if the object class is able to be removed @rtype: boolean """ logger = logging.getLogger() user = self.getDetailedUser(uid) logger.info("Del object class") if "quota" in user.keys() or "networkquota" in user.keys()...
logger.info("Del Group object class") logger.info("group keys" + str(group.keys()))
logger.debug("Del Group object class") logger.debug("group keys" + str(group.keys()))
def delGroupQuotaObjectClass(self, cn): """ Return true if the objectClass is removed. @return: return True if the object class is able to be removed @rtype: boolean """ logger = logging.getLogger() group = self.getDetailedGroup(cn) logger.info("Del Group object class") logger.info("group keys" + str(group.keys())) if...
logger.info("ObjectClass to save:" + str( group["objectClass"]) )
logger.debug("ObjectClass to save:" + str( group["objectClass"]))
def delGroupQuotaObjectClass(self, cn): """ Return true if the objectClass is removed. @return: return True if the object class is able to be removed @rtype: boolean """ logger = logging.getLogger() group = self.getDetailedGroup(cn) logger.info("Del Group object class") logger.info("group keys" + str(group.keys())) if...
logger.info("SetGroupDiskQuota: Overwrite mode: " + overwrite) logger.info("ldap timeout:" + str(self.l.timeout))
logger.debug("SetGroupDiskQuota: Overwrite mode: " + overwrite) logger.debug("ldap timeout:" + str(self.l.timeout))
def setGroupDiskQuota(self, group, device, quota, overwrite): logger = logging.getLogger() logger.info("SetGroupDiskQuota: Overwrite mode: " + overwrite) logger.info("ldap timeout:" + str(self.l.timeout)) self.l.set_option(ldap.OPT_NETWORK_TIMEOUT, 100) logger.info("ldap network timeout:" + str(self.l.get_option(ldap.O...
logger.info("ldap network timeout:" + str(self.l.get_option(ldap.OPT_NETWORK_TIMEOUT)))
logger.debug("ldap network timeout:" + str(self.l.get_option(ldap.OPT_NETWORK_TIMEOUT)))
def setGroupDiskQuota(self, group, device, quota, overwrite): logger = logging.getLogger() logger.info("SetGroupDiskQuota: Overwrite mode: " + overwrite) logger.info("ldap timeout:" + str(self.l.timeout)) self.l.set_option(ldap.OPT_NETWORK_TIMEOUT, 100) logger.info("ldap network timeout:" + str(self.l.get_option(ldap.O...
logger.info("SetGroupNetworkQuota Overwrite mode: " + overwrite)
logger.debug("SetGroupNetworkQuota Overwrite mode: " + overwrite)
def setGroupNetworkQuota(self, group, network, quota, overwrite): logger = logging.getLogger() logger.info("SetGroupNetworkQuota Overwrite mode: " + overwrite) self.addGroupDefaultDiskQuotaObjectClass(group) ldapquota = '%s,%s' % (network, str(int(quota) * 1048576)) # @todo improve this, it's a copy of set disk quota. ...
logger.info("Set user quota defaults: user: " + uid + " group: " + group)
logger.debug("Set user quota defaults: user: " + uid + " group: " + group)
def setUserQuotaDefaults(self, uid, group): # @todo: unfinished, does nothing yet. logger = logging.getLogger() logger.info("Set user quota defaults: user: " + uid + " group: " + group) keys = [] # don't set the quota if one has been set before. logger.info(self.getDetailedUser(uid)["objectClass"]) logger.info("Value o...
logger.info(self.getDetailedUser(uid)["objectClass"]) logger.info("Value of: self.hasDiskQuotaObjectClass(uid)" + str(self.hasDiskQuotaObjectClass(uid)))
logger.debug(self.getDetailedUser(uid)["objectClass"]) logger.debug("Value of: self.hasDiskQuotaObjectClass(uid)" + str(self.hasDiskQuotaObjectClass(uid)))
def setUserQuotaDefaults(self, uid, group): # @todo: unfinished, does nothing yet. logger = logging.getLogger() logger.info("Set user quota defaults: user: " + uid + " group: " + group) keys = [] # don't set the quota if one has been set before. logger.info(self.getDetailedUser(uid)["objectClass"]) logger.info("Value o...
logger.info("User already has quota Object class")
logger.debug("User already has quota Object class")
def setUserQuotaDefaults(self, uid, group): # @todo: unfinished, does nothing yet. logger = logging.getLogger() logger.info("Set user quota defaults: user: " + uid + " group: " + group) keys = [] # don't set the quota if one has been set before. logger.info(self.getDetailedUser(uid)["objectClass"]) logger.info("Value o...
logger.info("copy quota values to user:" + uid)
logger.debug("copy quota values to user:" + uid)
def setUserQuotaDefaults(self, uid, group): # @todo: unfinished, does nothing yet. logger = logging.getLogger() logger.info("Set user quota defaults: user: " + uid + " group: " + group) keys = [] # don't set the quota if one has been set before. logger.info(self.getDetailedUser(uid)["objectClass"]) logger.info("Value o...
logger.info("copy network quota values to user:" + uid)
logger.debug("copy network quota values to user:" + uid)
def setUserQuotaDefaults(self, uid, group): # @todo: unfinished, does nothing yet. logger = logging.getLogger() logger.info("Set user quota defaults: user: " + uid + " group: " + group) keys = [] # don't set the quota if one has been set before. logger.info(self.getDetailedUser(uid)["objectClass"]) logger.info("Value o...
logger.info("Delete quotas for members of:" + cn) logger.info("ldap timeout:" + str(self.l.timeout))
logger.debug("Delete quotas for members of:" + cn) logger.debug("ldap timeout:" + str(self.l.timeout))
def deleteGroupDiskQuotas(self, cn, device): logger = logging.getLogger() devicepath = device.split(':')[0] logger.info("Delete quotas for members of:" + cn) logger.info("ldap timeout:" + str(self.l.timeout)) self.l.set_option(ldap.OPT_NETWORK_TIMEOUT, 100) logger.info("ldap network timeout:" + str(self.l.get_option(ld...
logger.info("ldap network timeout:" + str(self.l.get_option(ldap.OPT_NETWORK_TIMEOUT)))
logger.debug("ldap network timeout:" + str(self.l.get_option(ldap.OPT_NETWORK_TIMEOUT)))
def deleteGroupDiskQuotas(self, cn, device): logger = logging.getLogger() devicepath = device.split(':')[0] logger.info("Delete quotas for members of:" + cn) logger.info("ldap timeout:" + str(self.l.timeout)) self.l.set_option(ldap.OPT_NETWORK_TIMEOUT, 100) logger.info("ldap network timeout:" + str(self.l.get_option(ld...
@param uidUser: computer name @type uidUser: str """ name='uid=' + uid + ',' + self.baseComputersDN
@param uid: computer name @type uid: str """ name='uid=' + uid + ',' + self.baseComputersDN
def delMachine(self, uid): """ Remove a computer account from LDAP
result_set = self.search(searchFilter, base, ["uid", "displayName"], ldap.SCOPE_ONELEVEL)
result_set = self.search(searchFilter, base, ["uid", "displayName", "sambaAcctFlags"], ldap.SCOPE_ONELEVEL)
def searchMachine(self, pattern = '', base = None): """ @return: a list of SAMBA computer accounts @rtype: list """ if (pattern==''): searchFilter = "uid=*" else: searchFilter = "uid=" + pattern # Always add $ to the search pattern, because a SAMBA computer account # ends with a $. searchFilter = searchFilter + "$" if ...
for logs in qlog: laction = self.session.query(Event).filter(and_(self.parent.event_table.c.id==logs.event_id, self.parent.event_table.c.module_id==logs.module_id)).first() lparam = self.session.query(Parameters).filter(self.parent.param_table.c.record_id == logs.id).all() lplugin = self.session.query(Module).filter(se...
for record in qlog: laction = self.session.query(Event).filter(and_(self.parent.event_table.c.id==record.event_id, self.parent.event_table.c.module_id==record.module_id)).first() lparam = self.session.query(Parameters).filter(self.parent.param_table.c.record_id == record.id).all() lplugin = self.session.query(Module).f...
def getArrayLogs(self,qlog): """ return an array of log @param qlog: list of Log @type qlog: list """ self.logresult=[] for logs in qlog: laction = self.session.query(Event).filter(and_(self.parent.event_table.c.id==logs.event_id, self.parent.event_table.c.module_id==logs.module_id)).first() lparam = self.session.que...
if listobj != None: llistobj=[] for objects in listobj:
llistobj=[] if listobj != None: for objects in listobj:
def getArrayLogs(self,qlog): """ return an array of log @param qlog: list of Log @type qlog: list """ self.logresult=[] for logs in qlog: laction = self.session.query(Event).filter(and_(self.parent.event_table.c.id==logs.event_id, self.parent.event_table.c.module_id==logs.module_id)).first() lparam = self.session.que...
if lobject.type_id==2: lpattr = self.session.query(Previous_Value).filter(self.parent.previous_value_table.c.object_log_id==objects.id).all() pattr=[] for p in lpattr: pattr.append(p.value) lcattr = self.session.query(Current_Value).filter(self.parent.current_value_table.c.object_log_id==objects.id).all() cattr=[...
lpattr = self.session.query(Previous_Value).filter(self.parent.previous_value_table.c.object_log_id==objects.id).all() pattr=[] for p in lpattr: pattr.append(p.value) lcattr = self.session.query(Current_Value).filter(self.parent.current_value_table.c.object_log_id==objects.id).all() cattr=[] for c in lcattr: catt...
def getArrayLogs(self,qlog): """ return an array of log @param qlog: list of Log @type qlog: list """ self.logresult=[] for logs in qlog: laction = self.session.query(Event).filter(and_(self.parent.event_table.c.id==logs.event_id, self.parent.event_table.c.module_id==logs.module_id)).first() lparam = self.session.que...
"id":str(logs.id), "date":str(logs.date), "commit":logs.result,
"id":str(record.id), "date":str(record.date), "commit":record.result,
def getArrayLogs(self,qlog): """ return an array of log @param qlog: list of Log @type qlog: list """ self.logresult=[] for logs in qlog: laction = self.session.query(Event).filter(and_(self.parent.event_table.c.id==logs.event_id, self.parent.event_table.c.module_id==logs.module_id)).first() lparam = self.session.que...
ipIsr.saturationInterpolation(exposure, fwhm, growFootprints=1, maskName='SAT')
sdefects = ipIsr.defectListFromMask(exposure, growFootprints=1, maskName='SAT')
def process(self, clipboard): """ """ self.log.log(Log.INFO, "Doing CCD defect mask.") #grab exposure from clipboard exposure = clipboard.get(self.policy.getString("inputKeys.ccdExposure"))
fwhm, interpolate=True, maskName='BAD')
fwhm, interpolate=False, maskName='BAD') for d in sdefects: nd = measAlg.Defect(d.getBBox()) defectList.append(nd) ipIsr.interpolateDefectList(exposure, defectList, fwhm) unc = ipIsr.UnmaskedNanCounterF() unc.apply(exposure.getMaskedImage()) nnans = unc.getNpix() metadata = exposure.getMetadata() metadata.set("numNans"...
def process(self, clipboard): """ """ self.log.log(Log.INFO, "Doing CCD defect mask.") #grab exposure from clipboard exposure = clipboard.get(self.policy.getString("inputKeys.ccdExposure"))
d.shift(-x, -y) bbox = d.getBBox()
d1 = measAlg.Defect(d.getBBox()) d1.shift(-x, -y) bbox = d1.getBBox()
def process(self, clipboard): """ """ self.log.log(Log.INFO, "Doing Saturation correction.") #grab exposure from clipboard exposure = clipboard.get(self.policy.getString("inputKeys.exposure")) exposure = ipIsr.convertImageForIsr(exposure) fwhm = self.policy.getDouble("parameters.defaultFwhm") amp = cameraGeom.cast_Amp...
id = cameraGeom.Id("R:2,3 S:1,1 C:0,0", ix=0, iy=0)
def testPipe(self): id = cameraGeom.Id("R:2,3 S:1,1 C:0,0", ix=0, iy=0) clipboard = pexClipboard.Clipboard() clipboard.put("ampId", id) clipboard.put("cameraPolicy", self.cameraPolicy ) clipboard.put("Exposure", self.exposure) clipboard.put("fwhm", 5.) file = pexPolicy.DefaultPolicyFile("ip_pipeline", "MakeCameraGeomSt...
clipboard.put("ampId", id)
clipboard.put("ampId", self.id)
def testPipe(self): id = cameraGeom.Id("R:2,3 S:1,1 C:0,0", ix=0, iy=0) clipboard = pexClipboard.Clipboard() clipboard.put("ampId", id) clipboard.put("cameraPolicy", self.cameraPolicy ) clipboard.put("Exposure", self.exposure) clipboard.put("fwhm", 5.) file = pexPolicy.DefaultPolicyFile("ip_pipeline", "MakeCameraGeomSt...
self.devices[path] = Device(device)
self.devices_tree[path] = Device(device) self.devices_list[path] = Device(device)
def device_added(self, device, subsystem): '''Called when a device has been added to the system''' print device, subsystem path = device.get_sysfs_path() self.devices[path] = Device(device) self.emit('connected', device)
vars=["FC", "FCFLAGS", "_FCINCFLAGS", "FC_TGT_F", "FC_SRC_F",
vars=["FC", "FCFLAGS", "_FCINCFLAGS", "FC_SRC_F", "FC_TGT_F"
def tolist(xx): if isinstance(xx, str): return [xx] return xx
func=fortran_compile,
func=fortran_module_compile,
def tolist(xx): if isinstance(xx, str): return [xx] return xx
ext_out=EXT_MOD,
def tolist(xx): if isinstance(xx, str): return [xx] return xx
return 'lib%s.so'
if cmp(Options.platform, 'darwin') == 0: return 'lib%s.dylib' if cmp(Options.platform, 'linux') == 0: return 'lib%s.so'
def get_name(): if 'fprogram' in self.features: return '%s' elif 'fshlib' in self.features: return 'lib%s.so' else: return 'lib%s.a'
monthes = {0: _("Month"),
months = {0: _("Month"),
def get_i18n_month_name(month_nb, display='short', ln=CFG_SITE_LANG): """ get a non-numeric representation of a month, internationalized. @param month_nb: number of month, (1 based!) =>1=jan,..,12=dec @param ln: language for output @return: the string representation of month """ _ = gettext_set_language(ln) if display ...
return monthes[month_nb]
return months[month_nb]
def get_i18n_month_name(month_nb, display='short', ln=CFG_SITE_LANG): """ get a non-numeric representation of a month, internationalized. @param month_nb: number of month, (1 based!) =>1=jan,..,12=dec @param ln: language for output @return: the string representation of month """ _ = gettext_set_language(ln) if display ...
outputmask = self.make_mask_from_threshhold(outputmask, 0.01, outputmask)
if(not os.path.exists(outputmask)): outputmask = self.make_mask_from_threshhold(outputmask, 0.01, outputmask)
def makemaskimage(self, outputmask='', imagename='', maskobject=[], slice=-1): """ This function is an attempt to convert all the kind of 'masks' that people want to throw at it and convert it to a mask image to be used by imager...For now 'masks' include a)set of previous mask images b)lists of blc trc's c)record out...
self.res = None default(plotms) self._cleanUp() shutil.copytree(self.datapath+self.ms, self.ms)
if (self.display): self.res = None default(plotms) self._cleanUp() shutil.copytree(self.datapath+self.ms, self.ms)
def setUp(self): self.res = None default(plotms) self._cleanUp() shutil.copytree(self.datapath+self.ms, self.ms)
self._cleanUp() pm.setPlotMSFilename("")
if (self.display): self._cleanUp() pm.setPlotMSFilename("")
def tearDown(self): self._cleanUp() pm.setPlotMSFilename("")
self.assertTrue(os.path.isfile(self.plotfile_jpg)) self._compareSHA(self.plotfile_jpg)
self._checkPlotFile()
def test000(self): '''Test 0: Write a jpg file using the pm tool''' pm.setPlotMSFilename(self.ms) pm.show() while (pm.isDrawing()): time.sleep(0.5) pm.save(self.plotfile_jpg) self._waitForFile(self.plotfile_jpg, 10) self.assertTrue(os.path.isfile(self.plotfile_jpg)) self._compareSHA(self.plotfile_jpg)
self.assertTrue(os.path.isfile(self.plotfile_jpg)) self._compareSHA(self.plotfile_jpg)
self._checkPlotFile()
def test001(self): '''Test 1: Write a jpg file using the plotms task''' self.res = plotms(vis=self.ms, plotfile=self.plotfile_jpg) self.assertTrue(self.res) self._waitForFile(self.plotfile_jpg, 10) self.assertTrue(os.path.isfile(self.plotfile_jpg)) self._compareSHA(self.plotfile_jpg)
self._compareSHA(self.plotfile_jpg) def _compareSHA(self, file1, file2=None): if (file2==None): file2 = self.datapath+"/"+ file1 self.assertEqual( sha.new(open(file1,'r').read()).hexdigest(), sha.new(open(file2,'r').read()).hexdigest() )
self.assertTrue(os.path.getsize(self.plotfile_jpg) > self.plotfile_minsize) if(self.plotfile_hash): self.assertEqual( sha.new(open(self.plotfile_jpg, 'r').read()).hexdigest(), self.plotfile_hash ) else: self.plotfile_hash = sha.new(open(self.plotfile_jpg, 'r').read()).hexdigest()
def test002(self): '''Test 2: Check overwrite functionality works''' self.res = plotms(vis=self.ms, plotfile=self.plotfile_jpg) self.assertTrue(self.res) self._waitForFile(self.plotfile_jpg, 10) self.res = plotms(vis=self.ms, plotfile=self.plotfile_jpg) self.assertFalse(self.res) time.sleep(5) self.res = plotms(vis=sel...
verbose=True
verbose=True, apcorrected=False
def verify_asdm(asdmname, withPointing): print "Verifying asdm ", asdmname if(not os.path.exists(asdmname)): print "asdm ", asdmname, " doesn't exist." raise Exception # test for the existence of all obligatory tables allTables = [ "Antenna.xml", "ASDM.xml", # "CalData.xml", # "CalDelay.xml", # "CalReduction.xml", "Con...
archiveid="S1"
archiveid="S1", apcorrected=False
def verify_asdm(asdmname, withPointing): print "Verifying asdm ", asdmname if(not os.path.exists(asdmname)): print "asdm ", asdmname, " doesn't exist." raise Exception # test for the existence of all obligatory tables allTables = [ "Antenna.xml", "ASDM.xml", # "CalData.xml", # "CalDelay.xml", # "CalReduction.xml", "Con...
print "real input MS, default output" rval = exportasdm( vis = 'myinput.ms', asdm = 'exportasdm-output.asdm', archiveid="S1" ) print "rval is ", rval if not rval: raise Exception omsname = "test"+str(testnumber)+'exportasdm-output.asdm' os.system('rm -rf '+omsname+'; mv exportasdm-output.asdm '+omsname) verify_asdm(oms...
print "real input MS, MS has several SPWs observed in parallel - not supported, expected error" rval = exportasdm( vis = 'myinput.ms', asdm = 'exportasdm-output.asdm', archiveid="S1", apcorrected=False ) print "rval is ", rval if not rval: print myname, ': *** Error as expected ***' else: print "Failed ..." failures +=...
def verify_asdm(asdmname, withPointing): print "Verifying asdm ", asdmname if(not os.path.exists(asdmname)): print "asdm ", asdmname, " doesn't exist." raise Exception # test for the existence of all obligatory tables allTables = [ "Antenna.xml", "ASDM.xml", # "CalData.xml", # "CalDelay.xml", # "CalReduction.xml", "Con...