rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
return [self.id, self.event_id, self.initiator_id, self.object_user_id, self.log_date, self.module_id, self.result] | return [self.id, self.event_id, self.initiator_id, self.user_id, self.date, self.module_id, self.result] | def __repr__(self): return [self.id, self.event_id, self.initiator_id, self.object_user_id, self.log_date, self.module_id, self.result] |
if 'ntblfix' in self.menu : m.setNTBLFix(self.menu['ntblfix']) | if 'update_nt_boot' in self.menu: m.setNTBLFix(self.menu['update_nt_boot']) | def make(self, macaddress = None): """ @return: an ImagingMenu object @rtype: ImagingMenu """ m = ImagingMenu(self.config, macaddress) m.setSplashImage(self.menu['background_uri']) m.setMessage(self.menu['message']) m.setTimeout(self.menu['timeout']) m.setDefaultItem(int(self.menu['default_item'])) m.setProtocol(self.m... |
if self.disklesscli: | if self.ntblfix: | def buildMenu(self): """ @return: the GRUB boot menu as a string encoded using CP-437 @rtype: str """ # takes global items, one by one buf = '# Auto-generated by Pulse 2 Imaging Server on %s \n\n' % time.asctime() |
buf += 'hide\n' | buf += 'hiddenmenu\n' if self.debug: buf += 'nosecurity\n' | def buildMenu(self): """ @return: the GRUB boot menu as a string encoded using CP-437 @rtype: str """ # takes global items, one by one buf = '# Auto-generated by Pulse 2 Imaging Server on %s \n\n' % time.asctime() |
macaddress = ComputerManager().getMachineMac(ctx, {'uuid':computerUUID}) | query = ComputerManager().getMachineMac(ctx, {'uuid':computerUUID}) try: macaddress = query[computerUUID] except KeyError: macaddress = [] | def checkComputerForImaging(self, computerUUID): """ @return: 0 if the computer can be registered into the imaging module @rtype: int """ ctx = self.currentContext macaddress = ComputerManager().getMachineMac(ctx, {'uuid':computerUUID}) if len(macaddress) > 1: # More than one MAC address ret = 2 elif pulse2.utils.isLin... |
ret = 1 | ret = 3 | def checkComputerForImaging(self, computerUUID): """ @return: 0 if the computer can be registered into the imaging module @rtype: int """ ctx = self.currentContext macaddress = ComputerManager().getMachineMac(ctx, {'uuid':computerUUID}) if len(macaddress) > 1: # More than one MAC address ret = 2 elif pulse2.utils.isLin... |
mi = mi.select_from(self.menu_item \ .join(self.menu, self.menu.c.id == self.menu_item.c.fk_menu) \ .outerjoin(self.target) \ .outerjoin(self.entity, or_(self.entity.c.id == self.target.c.fk_entity, self.entity.c.fk_default_menu == self.menu.c.id))) mi = mi.filter(and_(self.menu_item.c.id == uuid2id(mi_uuid), self.enti... | j = self.menu_item.join(self.menu, self.menu_item.c.fk_menu == self.menu.c.id).join(self.target).join(self.entity) mi = mi.select_from(j) f = self.menu_item.c.id == uuid2id(mi_uuid) mi = mi.filter(f) mi = mi.first() | def isLocalBootService(self, mi_uuid, session = None): """ Check if MenuItem mi is a local boot service FIXME : This should be fixed - entity.fk_default_menu do not exists anymore - but I reaaly don't see how """ session_need_to_close = False if session == None: session_need_to_close = True session = create_session() |
j = self.synchro_state.join(self.menu).join(self.target, self.menu.c.id == self.target.c.fk_menu).join(self.entity, self.entity.c.id == self.target.c.fk_entity) | j = self.synchro_state.join(self.menu).join(self.target).join(self.entity) | def getLocationSynchroState(self, uuid): """ Attempt to see if a location uuid needs to be synced, or not |
q1 = q1.filter(j) | q1 = q1.filter(f) | def getLocationSynchroState(self, uuid): """ Attempt to see if a location uuid needs to be synced, or not |
self.hooks_dir = self.cp.get("hooks-server", "hooks_dir") | self.hooks_dir = self.cp.get("hooks", "hooks_dir") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "create_client_path") | self.cp.get("hooks", "create_client_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
if self.cp.has_option("hooks", "update_client"): | if self.cp.has_option("hooks", "update_client_path"): | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "update_client") | self.cp.get("hooks", "update_client_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
if self.cp.has_option("hooks", "process_inventory"): | if self.cp.has_option("hooks", "process_inventory_path"): | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "process_inventory") | self.cp.get("hooks", "process_inventory_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
if self.cp.has_option("hooks", "create_image"): | if self.cp.has_option("hooks", "create_image_path"): | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "create_image") | self.cp.get("hooks", "create_image_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
if self.cp.has_option("hooks", "update_image"): | if self.cp.has_option("hooks", "update_image_path"): | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "update_image") | self.cp.get("hooks", "update_image_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
if self.cp.has_option("hooks", "log_action"): | if self.cp.has_option("hooks", "log_action_path"): | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "log_action") | self.cp.get("hooks", "log_action_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
if self.cp.has_option("hooks", "get_uuid"): | if self.cp.has_option("hooks", "get_uuid_path"): | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "get_uuid") | self.cp.get("hooks", "get_uuid_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
if self.cp.has_option("hooks", "get_hostname"): | if self.cp.has_option("hooks", "get_hostname_path"): | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "get_hostname") | self.cp.get("hooks", "get_hostname_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
if self.cp.has_option("hooks", "mtftp_sync"): | if self.cp.has_option("hooks", "mtftp_sync_path"): | def setup(self, config_file): """ Setup config object according to config_file content. """ |
self.cp.get("hooks-server", "mtftp_sync") | self.cp.get("hooks", "mtftp_sync_path") | def setup(self, config_file): """ Setup config object according to config_file content. """ |
@return: the MAC address without ':' | @return: the MAC address in upper case without ':' | def reduceMACAddress(mac): """ @return: the MAC address without ':' """ assert isMACAddress(mac) ret = mac ret = ret.replace(':', '') ret = ret.replace('-', '') ret = ret.replace('.', '') return ret |
ret = mac | ret = mac.upper() | def reduceMACAddress(mac): """ @return: the MAC address without ':' """ assert isMACAddress(mac) ret = mac ret = ret.replace(':', '') ret = ret.replace('-', '') ret = ret.replace('.', '') return ret |
return ':'.join(map(lambda (x,y): x + y, zip(reduceMACAddress(mac)[0:11:2].upper(), reduceMACAddress(mac)[1:12:2].upper()))) | return ':'.join(map(lambda (x,y): x + y, zip(reduceMACAddress(mac)[0:11:2], reduceMACAddress(mac)[1:12:2]))) | def normalizeMACAddress(mac): """ @return: the MAC address normalized (see this module documentation) """ assert isMACAddress(mac) return ':'.join(map(lambda (x,y): x + y, zip(reduceMACAddress(mac)[0:11:2].upper(), reduceMACAddress(mac)[1:12:2].upper()))) # any questions ? |
raise TypeError, 'Bad menu structure' | raise TypeError('Bad menu structure') | def __init__(self, config, menu): self.logger = logging.getLogger() if not isMenuStructure(menu): raise TypeError, 'Bad menu structure' self.menu = menu self.config = config |
self.assertEqual(result, ['Entity/Label', 'Software/ProductName', 'Hardware/OperatingSystem', 'Registry/Value/display name', 'Drive/TotalSpace', 'Hardware/ProcessorType', 'Software/Products']) | self.assertEqual(result, ['Inventory/Date', 'Entity/Label', 'Software/ProductName', 'Hardware/OperatingSystem', 'Registry/Value/display name', 'Drive/TotalSpace', 'Hardware/ProcessorType', 'Software/Products']) | def test240getPossiblesCriterionsInMainModule(self): result = self.client.getPossiblesCriterionsInMainModule() self.assertEqual(result, ['Entity/Label', 'Software/ProductName', 'Hardware/OperatingSystem', 'Registry/Value/display name', 'Drive/TotalSpace', 'Hardware/ProcessorType', 'Software/Products']) |
self.assertEqual(result, ['Entity/Label', 'Software/ProductName', 'Hardware/OperatingSystem', 'Registry/Value/display name', 'Drive/TotalSpace', 'Hardware/ProcessorType', 'Software/Products']) | self.assertEqual(result, ['Inventory/Date', 'Entity/Label', 'Software/ProductName', 'Hardware/OperatingSystem', 'Registry/Value/display name', 'Drive/TotalSpace', 'Hardware/ProcessorType', 'Software/Products']) | def test241getPossiblesCriterionInModule(self): result = self.client.getPossiblesCriterionsInModule('inventory') self.assertEqual(result, ['Entity/Label', 'Software/ProductName', 'Hardware/OperatingSystem', 'Registry/Value/display name', 'Drive/TotalSpace', 'Hardware/ProcessorType', 'Software/Products']) |
self.size = int(line_size_file_part.group(1)) * 512 | self.size = int(line_size_file_part.group(1)) * 1024 | def __init__(self, directory): """ Return Image stats (from conf.txt and others) """ assert isPulse2Image(directory) |
r.commit() | def changeGroupAttributes(self, group, attr, attrVal): """ change a group attributes | |
Build and return the db connection path according to the plugin configuration | Build and return the db connection path according to the plugin configuration. | def makeConnectionPath(self): """ Build and return the db connection path according to the plugin configuration |
if self.config.dbsslenable: url = url + "?ssl_ca=%s&ssl_key=%s&ssl_cert=%s" % (self.config.dbsslca, self.config.dbsslkey, self.config.dbsslcert) | if self.config.dbdriver == 'mysql': url += '?charset=utf8&use_unicode=0' if self.config.dbsslenable: url = url + "&ssl_ca=%s&ssl_key=%s&ssl_cert=%s" % (self.config.dbsslca, self.config.dbsslkey, self.config.dbsslcert) | def makeConnectionPath(self): """ Build and return the db connection path according to the plugin configuration |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def moveItemUpInMenu(self, target_uuid, target_type, mi_uuid): """ move a menu item up in the target's boot menu |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def moveItemDownInMenu(self, target_uuid, target_type, mi_uuid): """ move a menu item down in the target's boot menu |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def addImageToTarget(self, item_uuid, target_uuid, params, target_type): """ add an image to the target boot menu |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def editImageToTarget(self, item_uuid, target_uuid, params, target_type): """ edit the image to boot menu link parameters |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def editImage(self, item_uuid, target_uuid, params, target_type): """ edit an image |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def delImageToTarget(self, item_uuid, target_uuid, target_type): """ remove an image from a boot menu |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def addServiceToTarget(self, bs_uuid, target_uuid, params, target_type): """ add a boot service to a target boot menu |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def delServiceToTarget(self, bs_uuid, target_uuid, target_type): """ remove a boot service from a target boot menu |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def editServiceToTarget(self, bs_uuid, target_uuid, params, target_type): """ edit a boot service already associated to a target boot menu |
return [True, ret] | def linkImagingServerToLocation(self, is_uuid, loc_id, loc_name): """ link an imaging server to a location | |
logging.getLogger().warn("Imaging.linkImagingServerToLocation : %s" % e) return [False, "Failed to link Imaging Server to Location : %s" % e] return [True] | logging.getLogger().warn("Imaging.linkImagingServerToEntity : %s" % e) return [False, "Failed to link Imaging Server to Entity : %s" % e] return [True, ret] | def linkImagingServerToLocation(self, is_uuid, loc_id, loc_name): """ link an imaging server to a location |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def isTargetRegister(self, uuid, target_type): """ check if a target has already been registered or not |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def getTargetSynchroState(self, uuid, target_type): """ get the synchronization state of a target |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def __synchroTargets(self, uuids, target_type): """ synchronize targets with their imaging servers |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def getMyMenuTarget(self, uuid, target_type): """ get a target's boot menu and configuration it can come from the target itself, or from it's profile if it's a computer, or from it's entity whatever it is. |
2) 'group" or P2IT.PROFILE (2) for a profile | 2) 'group' or P2IT.PROFILE (2) for a profile | def setMyMenuTarget(self, uuid, params, target_type): """ set a boot menu and configuration for a target |
self.l.search_s(self.configPPolicy.ppolicydefaultdn, ldap.SCOPE_BASE) return True | self.l.search_s(self.configPPolicy.ppolicydefaultdn, ldap.SCOPE_BASE) ret = True | def checkPPolicy(self): ''' Check the presence of Password Policy @returns: True if it exists @rtype: bool ''' try: self.l.search_s(self.configPPolicy.ppolicydefaultdn, ldap.SCOPE_BASE) return True except ldap.NO_SUCH_OBJECT: return False |
return False | pass return ret | def checkPPolicy(self): ''' Check the presence of Password Policy @returns: True if it exists @rtype: bool ''' try: self.l.search_s(self.configPPolicy.ppolicydefaultdn, ldap.SCOPE_BASE) return True except ldap.NO_SUCH_OBJECT: return False |
if q2.label == "RUNNING" or q2.label == "INIT_ERROR" or q2.label == "TODO": session.close() return q2 | ret = [] ret.append( { 'id' : q2.id, 'label' : q2.label, 'item' : ""} ) | def getLocationSynchroState(self, uuid): """ Attempt to see if a location uuid needs to be synced, or not |
session.close() a_state = [0, 0] | def getLocationSynchroState(self, uuid): """ Attempt to see if a location uuid needs to be synced, or not | |
if q.label == "RUNNING" or q.label == "INIT_ERROR": return q a_state[q.id - 1] += 1 if a_state[0] == 0: return { 'id' : 2, 'label' : 'DONE'} return { 'id' : 1, 'label' : 'TODO'} | ret.append( { 'id' : q.id, 'label' : q.label, 'item' : target.uuid} ) session.close() return ret | def getLocationSynchroState(self, uuid): """ Attempt to see if a location uuid needs to be synced, or not |
if e.message == 'No rows returned for one()': | if hasattr(e, 'message'): if e.message == 'No rows returned for one()': self.logger.warn("Can't get the computer %s, we can't inject an inventory. This happen when the computer exists in the backend but is not declared in the imaging."%(computer_uuid)) return [False, "Can't get the computer %s, we can't inject an inven... | def injectInventory(self, imaging_server_uuid, computer_uuid, inventory): """ Inject a computer inventory into the dabatase. For now only the ComputerDisk and ComputerPartition tables are used. """ self.enableLogging(logging.INFO) if not isUUID(imaging_server_uuid): raise TypeError('Bad imaging server UUID: %s' % imagi... |
self.assertEqual(['UUID2', 'UUID3'], result) | self.assertEqual(['UUID3', 'UUID4'], result) | def test_03registerComputers(self): """ Check mass computers registration """ arg = [ ('hostname1', '00:11:22:33:44:dd', { 'uuid' : 'UUID3', 'menu' : { 'UUID3' : MENU }}), ('hostname2', '00:11:22:33:44:ee', { 'uuid' : 'UUID4', 'menu' : { 'UUID4' : MENU }}), ] result = SERVER.computersRegister(arg) self.assertEqual(['UU... |
m = re.search('^{(\w+)}(.+)$', value) if m: scheme = m.group(1) obfuscated = m.group(2) | match = re.search('^{(\w+)}(.+)$', value) if match: scheme = match.group(1) obfuscated = match.group(2) | def getpassword(self, section, option): """ Like get, but interpret the value as a obfuscated password if a password scheme is specified. |
if not conffile: self.conffile = mmctools.getConfigFile(name) | self.userDefault = {} self.hooks = {} if not conffile: self.conffile = mmctools.getConfigFile(name) | def __init__(self, name, conffile = None): MMCConfigParser.__init__(self) self.name = name if not conffile: self.conffile = mmctools.getConfigFile(name) else: self.conffile = conffile self.setDefault() fp = file(self.conffile, "r") self.readfp(fp, self.conffile) self.readConf() |
fp = file(self.conffile, "r") self.readfp(fp, self.conffile) | fid = file(self.conffile, "r") self.readfp(fid, self.conffile) | def __init__(self, name, conffile = None): MMCConfigParser.__init__(self) self.name = name if not conffile: self.conffile = mmctools.getConfigFile(name) else: self.conffile = conffile self.setDefault() fp = file(self.conffile, "r") self.readfp(fp, self.conffile) self.readConf() |
try: self.disabled = self.getboolean("main", "disable") except NoSectionError, NoOptionError: pass self.userDefault = {} | try: self.disabled = self.getboolean("main", "disable") except (NoSectionError, NoOptionError): pass | def readConf(self): """Read the configuration file""" try: self.disabled = self.getboolean("main", "disable") except NoSectionError, NoOptionError: pass self.userDefault = {} if self.has_section(self.USERDEFAULT): for option in self.options(self.USERDEFAULT): self.userDefault[option] = self.get(self.USERDEFAULT, option... |
self.hooks = {} | def readConf(self): """Read the configuration file""" try: self.disabled = self.getboolean("main", "disable") except NoSectionError, NoOptionError: pass self.userDefault = {} if self.has_section(self.USERDEFAULT): for option in self.options(self.USERDEFAULT): self.userDefault[option] = self.get(self.USERDEFAULT, option... | |
def __init__(self, module, event, user, objects, param, initiator, source, previous, current): | def __init__(self, module, event, user, objects, param, initiator, source, current, previous): | def __init__(self, module, event, user, objects, param, initiator, source, previous, current): """ Create a AuditRecord instance which contains all information that will be logged into database. @param module: module name @type module: string @param event: event name @type event: string @param user: user name @type us... |
if current != None: if type(current) == tuple or type(current) == list : for i in current: cv = Current_Value(bdobjectlogattr, i) session.save(cv) else: cv = Current_Value(bdobjectlogattr, current) session.save(cv) if previous != None: if type(previous) == tuple or type(previous) == list: for i in previous: pv = Prev... | if bdobjectlog != None: if current != None: if type(current) == tuple or type(current) == list : for i in current: cv = Current_Value(bdobjectlog, i) session.save(cv) else: cv = Current_Value(bdobjectlog, current) session.save(cv) if previous != None: if type(previous) == tuple or type(previous) == list: for i in pr... | def __init__(self, parent, module, event, user, objects, param, initiator, source, current, previous): """ Insert New log in database @param action: action name @type action: string @param module: module name @type action: string @param module: module name @type module: string @param user: tuple with user name and type... |
groups = groups.filter(self.groups.c.FK_user == root_id) | groups = groups.filter(self.groups.c.FK_users == root_id) | def __allgroups_query(self, ctx, params, session = None, type = 0): """ return a query on group filtered by several flags like canShow, dynamic, static, type (0 = group, 1 = profile) and filters like filter (on the group name with wildcards) and name (on the group name without wildcards) """ (select_from, filter_on) = ... |
if self.xmlrpc_computersMenuSet(imagingData): | if self.xmlrpc_computersMenuSet({ cuuid : imagingData[cuuid]}): | def onSuccess(result): if type(result) == dict : self.logger.warn('Imaging: Couldn\'t register client %s (%s) : %s' % (computerName, MACAddress, str(result))) return False |
if '' in macaddresses: | if [''] in macaddresses: | def checkProfileForImaging(self, profileUUID): """ @return: 0 if the profile can be registered into the imaging module @rtype: int """ ret = 0 ctx = self.currentContext uuids = map(lambda c: c.uuid, ComputerProfileManager().getProfileContent(profileUUID)) macaddresses = ComputerManager().getMachineMac(ctx, {'uuids':uui... |
if not pulse2.utils.isLinuxMacAddress(macaddress): | if not pulse2.utils.isLinuxMacAddress(macaddress[0]): | def checkProfileForImaging(self, profileUUID): """ @return: 0 if the profile can be registered into the imaging module @rtype: int """ ret = 0 ctx = self.currentContext uuids = map(lambda c: c.uuid, ComputerProfileManager().getProfileContent(profileUUID)) macaddresses = ComputerManager().getMachineMac(ctx, {'uuids':uui... |
POSTINST = 'initinst' | POSTINST = 'postinst' | def getEntry(self, protocol, network = True): """ Return the entry, in a GRUB compatible format """ buf = 'title %s\n' % self.title if self.desc: buf += 'desc %s\n' % self.desc if self.value: buf += self.value + '\n' return self._applyReplacement(buf, network) |
result = SERVER.imagingSERVERStatus() | result = SERVER.imagingServerStatus() | def test_20imagingServerStatus(self): """ check for imagingServerStatus """ result = SERVER.imagingSERVERStatus() self.assertEqual(dict, type(result)) self.assertTrue('space_available' in result) self.assertTrue('mem_info' in result) self.assertTrue('disk_info' in result) self.assertTrue('uptime' in result) self.assert... |
result = SERVER.injectInventory('00:11:22:33:44:77', inventory) | result = SERVER.injectInventory('00:11:22:33:44:ff', inventory) | def test_04inventory(self): """ Inventory injection test """ inventory = {'memslot': {'speed': 18756, 'type': '7', 'location': 'DIMM 0', 'ff': 9, 'size': 128}, 'numcpu': 1, 'featcpu': [6, 2, 3, 0, 4, 0, 0, 0, 253, 251, 139, 7, 71, 101, 110, 117, 105, 110, 101, 73, 110, 116, 101, 108], 'mem': {'upper': 128972, 'lower': ... |
'ntblfix', | def isMenuStructure(menu): """ @return: True if the given object is a menu structure @rtype: bool """ ret = True logger = logging.getLogger() if type(menu) == dict: for k in ['message', 'protocol', 'default_item', 'default_item_WOL', 'timeout', 'background_uri', 'bootservices', 'images', 'bootcli', 'ntblfix', 'diskless... | |
m.setNTBLFix(self.menu['ntblfix']) | if 'ntblfix' in self.menu : m.setNTBLFix(self.menu['ntblfix']) | def make(self, macaddress = None): """ @return: an ImagingMenu object @rtype: ImagingMenu """ m = ImagingMenu(self.config, macaddress) m.setSplashImage(self.menu['background_uri']) m.setMessage(self.menu['message']) m.setTimeout(self.menu['timeout']) m.setDefaultItem(int(self.menu['default_item'])) m.setProtocol(self.m... |
'images']: | 'images', 'bootcli', 'ntblfix', 'disklesscli', 'dont_check_disk_size', 'ethercard']: | def isMenuStructure(menu): """ @return: True if the given object is a menu structure @rtype: bool """ ret = True logger = logging.getLogger() if type(menu) == dict: for k in ['message', 'protocol', 'default_item', 'default_item_WOL', 'timeout', 'background_uri', 'bootservices', 'images']: if not k in menu: logger.debug... |
except ldap.ALREADY_EXISTS, err: | def addOu(self, ouname, ldappath): """ add an organizational Unit to an ldap entry | |
r.commit() | except ldap.ALREADY_EXISTS: r.commit() | def addOu(self, ouname, ldappath): """ add an organizational Unit to an ldap entry |
self.logger.error('Imaging: Couldn\'t set default entry on %s for %s : %s' % (num, computerUUID, str(result))) | self.logger.info('Imaging: Successfully set default entry on %s for %s' % (num, computerUUID)) | def _onSuccess(result): if type(result) != list and len(result) != 2: self.logger.error('Imaging: Couldn\'t set default entry on %s for %s : %s' % (num, computerUUID, str(result))) ret = False elif not result[0]: self.logger.error('Imaging: Couldn\'t set default entry on %s for %s : %s' % (num, computerUUID, str(result... |
self.logger.debug('Imaging: Successfully registered image %s' % imageUUID) | self.logger.info('Imaging: Successfully registered image %s' % imageUUID) | def _onSuccess(result): if type(result) != list and len(result) != 2: self.logger.error('Imaging: Couldn\'t register on the MMC agent the image with UUID %s : %s' % (imageUUID, str(result))) ret = False elif not result[0]: self.logger.error('Imaging: Couldn\'t register on the MMC agent the image with UUID %s : %s' % (i... |
updated = self.config.getint(section, 'updated') | updated = int(self.config.get(section, 'updated')) | def getByMac(self, mac): """ Get a computer by its MAC from the cache. |
updated = self.config.getint(section, 'updated') | updated = int(self.config.get(section, 'updated')) | def getByShortName(self, name): """ Get a computer by its shortname from the cache. |
updated = self.config.getint(uuid, 'updated') | updated = int(self.config.get(uuid, 'updated')) | def getByUUID(self, uuid): """ Get a computer by its UUID from the cache. |
pulse2.utils.Singleton.__init__(self) | def __init__(self): pulse2.utils.Singleton.__init__(self) if not os.path.isfile(self.cachePath): try: self.log.info("Creating 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 create my UUID Cache File %s : %s" % (self.c... | |
self.config.read(fp) | self.config.readfp(fp) | def _fetch(self): """ Update memory stucture using our cache file """ try: self.log.info("Reading my UUID Cache File %s" % (self.cachePath)) fp = open(self.cachePath, 'rb') self.config.read(fp) fp.close() except Exception, e: self.log.warn("Can't read my UUID Cache File %s : %s" % (self.cachePath, e)) return False retu... |
{ 'uuid' : 'UUID2', 'menu' : MENUS }), | { 'uuid' : 'UUID2', 'menu' : { 'UUID2' : MENU }}), | def test_03registerComputers(self): """ Check mass computers registration """ arg = [ ('hostname1', '00:11:22:33:44:dd', { 'uuid' : 'UUID2', 'menu' : MENUS }), ('hostname2', '00:11:22:33:44:ee', { 'uuid' : 'UUID3', 'menu' : MENUS }), ] result = SERVER.computersRegister(arg) self.assertEqual([['hostname1', '00:11:22:33:... |
{ 'uuid' : 'UUID3', 'menu' : MENUS }), | { 'uuid' : 'UUID3', 'menu' : { 'UUID3' : MENU }}), | def test_03registerComputers(self): """ Check mass computers registration """ arg = [ ('hostname1', '00:11:22:33:44:dd', { 'uuid' : 'UUID2', 'menu' : MENUS }), ('hostname2', '00:11:22:33:44:ee', { 'uuid' : 'UUID3', 'menu' : MENUS }), ] result = SERVER.computersRegister(arg) self.assertEqual([['hostname1', '00:11:22:33:... |
def __init__(self, config, imageUUID, size): | def __init__(self, config, imageUUID, size, title): | def __init__(self, config, imageUUID, size): """ @param imageUUID: UUID of the Pulse 2 image to convert to an ISO @type imageUUID: str @param size: media size, in bytes @type size: int """ self.logger = logging.getLogger('imaging') self.config = config self.source = os.path.join(self.config.imaging_api['base_folder'], ... |
self.target = self.config.imaging_api['iso_folder'] if not os.path.isdir(self.target): self.logger.warn("Target directory %s for ISO image doesn't exist" % self.target) | if not title: raise ValueError('Image ISO title is empty') self.title = title targetdir = self.config.imaging_api['isos_folder'] if not os.path.isdir(targetdir): raise Exception("Target directory %s for ISO image doesn't exist" % targetdir) self.target = os.path.join(targetdir, title) | def __init__(self, config, imageUUID, size): """ @param imageUUID: UUID of the Pulse 2 image to convert to an ISO @type imageUUID: str @param size: media size, in bytes @type size: int """ self.logger = logging.getLogger('imaging') self.config = config self.source = os.path.join(self.config.imaging_api['base_folder'], ... |
buf.append("title %s\n" % 'FIXME') | buf.append("title %s\n" % self.title) | def _makeGRUBMenu(self, medialist): """ Build GRUB menu file """ buf = [] buf.append("color 6/0\n") buf.append("default 0\n") buf.append("title Local Hard Disk / Disque Dur Local\n") buf.append("desc Boot on the 1st local HD\n") buf.append("root (hd0)\n") buf.append("chainloader +1\n") buf.append("title %s\n" % 'FIXME'... |
self.config.imaging_api['cd_initrd']) | self.config.imaging_api['diskless_initrdcd']) | def _makeInitrd(self, medialist): """ Make the CD initrd file """ initrdfile = os.path.join(self.tempdir, PULSE2_IMAGING_ISO_INITRDFILE) initrd = os.path.join(self.config.imaging_api['base_folder'], self.config.imaging_api['diskless_folder'], self.config.imaging_api['diskless_initrd']) initrdcd = os.path.join(self.conf... |
args = ['-f', 'v', '-v', '-R'] | args = ['-f', '-v', '-v', '-R'] | def create(self): """ Generates the final ISO files. For now, the image are generated in background. """ for medianumber in self.medialist: args = ['-f', 'v', '-v', '-R'] # Volume ID args = args + ['-V', 'FIXME TITLE'] # Application ID args = args + ['-A', 'Pulse 2 Imaging Server'] # Output file args = args + ['-o', '%... |
getProcessOutputAndValue( | d = getProcessOutputAndValue( | def create(self): """ Generates the final ISO files. For now, the image are generated in background. """ for medianumber in self.medialist: args = ['-f', 'v', '-v', '-R'] # Volume ID args = args + ['-V', 'FIXME TITLE'] # Application ID args = args + ['-A', 'Pulse 2 Imaging Server'] # Output file args = args + ['-o', '%... |
args = (self.config.imaging_api['uuid']) | args = (self.config.imaging_api['uuid'], ) | def _errDefaultMenu(error): self.logger.error("Error while setting default computer boot menu: %s" % error) |
current_inventory_id = "" | current_inventory_id = None | def getComputerInventoryDiff(self, ctx, params): """ Returns the differences between an inventory of the given machine and the previous inventory |
current_inventory_id = params['inventoryId'] | current_inventory_id = int(params['inventoryId']) | def getComputerInventoryDiff(self, ctx, params): """ Returns the differences between an inventory of the given machine and the previous inventory |
if machine_previous_inventory_part != []: | try: | def getComputerInventoryDiff(self, ctx, params): """ Returns the differences between an inventory of the given machine and the previous inventory |
else: | except IndexError: | def getComputerInventoryDiff(self, ctx, params): """ Returns the differences between an inventory of the given machine and the previous inventory |
users = searchUserAdvanced() ret['installed_users'] = len(users) | ret['installed_users'], _ = searchUserAdvanced() | def getInformations(self, dynamic = False): if not self.config.is_subscribe_done: return { 'is_subsscribed': False } ret = { 'is_subsscribed':True, 'product_name':self.config.subs_product_name, 'vendor_name':self.config.subs_vendor_name, 'vendor_mail':self.config.subs_vendor_mail, 'customer_name':self.config.subs_custo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.