rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
javascript = [LocalJSLink('beaker', '/static/javascript/searchbar_v4.js')]
javascript = [LocalJSLink('beaker', '/static/javascript/searchbar_v5.js')]
def __json__(self): return { 'field_id' : self.field_id, }
javascript = [LocalJSLink('beaker', '/static/javascript/provision.js'),LocalJSLink('beaker', '/static/javascript/searchbar_v4.js')]
javascript = [LocalJSLink('beaker', '/static/javascript/provision.js'),LocalJSLink('beaker', '/static/javascript/searchbar_v5.js')]
def display(self,value=None,**params): if 'options' in params: if 'searchvalue' in params['options']: params['searchvalue'] = params['options']['searchvalue'] if 'action' in params: params['all_history'] = params['action'] return super(SystemHistory, self).display(value,**params)
return (self.recipe.watchdog.kill_time - datetime.utcnow()).seconds
delta = self.recipe.watchdog.kill_time - datetime.utcnow() return delta.seconds + (86400 * delta.days)
def status_watchdog(self): """ Return the number of seconds left on the current watchdog if it exists. """ if self.recipe.watchdog: return (self.recipe.watchdog.kill_time - datetime.utcnow()).seconds else: return False
data_setup.create_system(fqdn='nogroup.system')
data_setup.create_system(fqdn=u'nogroup.system')
def test_filter_by_group(self): data_setup.create_system(fqdn='nogroup.system') self.group = data_setup.create_group() data_setup.create_system(fqdn='grouped.system').groups.append(self.group) session.flush() feed_url = urljoin(get_server_base(), '?' + urlencode({ 'tg_format': 'atom', 'list_tgp_order': '-date_modified'...
data_setup.create_system(fqdn='grouped.system').groups.append(self.group)
data_setup.create_system(fqdn=u'grouped.system').groups.append(self.group)
def test_filter_by_group(self): data_setup.create_system(fqdn='nogroup.system') self.group = data_setup.create_group() data_setup.create_system(fqdn='grouped.system').groups.append(self.group) session.flush() feed_url = urljoin(get_server_base(), '?' + urlencode({ 'tg_format': 'atom', 'list_tgp_order': '-date_modified'...
sel.wait_for_page_to_load('30000')
try: sel.click('link=Show all') sel.wait_for_page_to_load('30000') except: pass
def check_column_sort(self, column): sel = self.selenium sel.wait_for_page_to_load('30000') sel.click('//table[@id="widget"]/thead/th[%d]//a[@href]' % column) sel.wait_for_page_to_load('30000') row_count = int(sel.get_xpath_count( '//table[@id="widget"]/tbody/tr/td[%d]' % column)) cell_values = [sel.get_table('widget.%...
log.append('%s: Invalid Key %s ' % data['key'])
log.append('%s: Invalid Key %s ' % (system.fqdn, data['key']))
def _from_csv(cls,system,data,csv_type,log): """ Import data from CSV file into System Objects """ if 'key' in data and data['key']: try: key = Key.by_name(data['key']) except InvalidRequestError: log.append('%s: Invalid Key %s ' % data['key']) return False else: log.append('%s: Key must not be blank!' % system.fqdn) r...
default_whiteboard_title = 'N/A'
default_whiteboard_title = ''
def get_results(self,arch,whiteboard=None): try: if not whiteboard: return_list = [] for w in self.results[arch]: return_list += self.results[arch][w] return return_list else: return self.results[arch][whiteboard] except KeyError, (e): #This is fine, just means that this task has no entry for a given arch/whiteboard #l...
whiteboard_title = whiteboard_name = self.default_whiteboard_title fields.append(InnerGrid.Column(name=whiteboard_name,
whiteboard_title = whiteboard_name = self.default_whiteboard_title random.seed() fields.append(InnerGrid.Column(name="%s_%s" % (whiteboard_name,random.random()),
def inner_data_grid(self,data,this_arch,show_headers): """ inner_data_grid() displays the grid that is the recipe whiteboard grid for each arch. """ fields = [] my_list = [] sorted_keys = sorted(set(self.whiteboards_used[this_arch])) for whiteboard in sorted_keys: whiteboard_title = whiteboard_name = orig_whiteboard_na...
print 'These are the dupe errors: %s' % dupe_errors
def update_products(xml_file): dom = etree.parse(xml_file) xpath_string = '//cpe' cpes = dom.xpath(xpath_string) session.begin() try: to_add = {} dupe_errors = [] for cpe in cpes: cpe_text = cpe.text if cpe_text in to_add: dupe_errors.append(cpe_text) else: to_add[cpe_text] = 1 for cpe_to_add in to_add: try: prod = ...
working = SystemStatus.by_name(u'Working')
def queued_recipes(*args): recipes = Recipe.query()\ .join('status')\ .join('systems')\ .join(['recipeset','priority'])\ .filter( or_( and_(Recipe.status==TaskStatus.by_name(u'Queued'), System.user==None, RecipeSet.lab_controller==None ), and_(Recipe.status==TaskStatus.by_name(u'Queued'), System.user==None, RecipeSet.l...
self.logger.info("Panic detected for system: %s" % self.watchdog['system'])
self.proxy.logger.info("Panic detected for system: %s" % self.watchdog['system'])
def update(self): """ If the log exists and the file has grown then upload the new piece """ if os.path.exists(self.log): file = open(self.log, "r") where = self.where file.seek(where) line = file.read(65536) self.where = file.tell() file.close() #FIXME make this work on a list of search items # Also, allow it to be di...
repos = self.doc.createElement('repos')
self.repos = self.doc.createElement('repos')
def __init__(self, *args, **kwargs): self.node = self.doc.createElement('recipe') self.node.setAttribute('whiteboard','') self.andDistroRequires = self.doc.createElement('and') self.andHostRequires = self.doc.createElement('and') distroRequires = self.doc.createElement('distroRequires') hostRequires = self.doc.createEl...
self.node.appendChild(repos)
self.node.appendChild(self.repos)
def __init__(self, *args, **kwargs): self.node = self.doc.createElement('recipe') self.node.setAttribute('whiteboard','') self.andDistroRequires = self.doc.createElement('and') self.andHostRequires = self.doc.createElement('and') distroRequires = self.doc.createElement('distroRequires') hostRequires = self.doc.createEl...
javascript = [LocalJSLink('bkr', '/static/javascript/reserve_workflow_v2.js')]
javascript = [LocalJSLink('bkr', '/static/javascript/reserve_workflow_v3.js')]
def update_params(self,d): log.debug(d) if 'value' in d: if 'distro_ids' in d['value']: if(isinstance(d['value']['distro_ids'],list)): for distro_id in d['value']['distro_ids']: d['hidden_fields'] = [HiddenField(name='distro_id',attrs = {'value' : distro_id})] + d['hidden_fields'][0:]
flash(_(u'Unable to find system with id of %s' % id))
flash(_(u'Unable to find system with id of %s' % system_id))
def report_problem(self, system_id, recipe_id=None, problem_description=None): """ Allows users to report a problem with a system to the system's owner. """ try: system = System.by_id(system_id, identity.current.user) except InvalidRequestError: flash(_(u'Unable to find system with id of %s' % id)) redirect('/') try: r...
def my_cmp(x,y): m1 = re.search('^(.+?)(\d{1,})?$',x) m2 = re.search('^(.+?)(\d{1,})?$',y) try: distro_1 = m1.group(1).lower() except AttributeError,e: return -1 try: distro_2 = m2.group(1).lower() except AttributeError,e: return 1 distro_1_ver = int(m1.group(2) or 0) distro_2_ver = int(m2.group(2) or 0) if not di...
def my_cmp(x,y): m1 = re.search('^(.+?)(\d{1,})?$',x) m2 = re.search('^(.+?)(\d{1,})?$',y) try: distro_1 = m1.group(1).lower() except AttributeError,e: #x has no value, it goes first return -1
@staticmethod def my_cmp(x,y): m1 = re.search('^(.+?)(\d{1,})?$',x) m2 = re.search('^(.+?)(\d{1,})?$',y) try: distro_1 = m1.group(1).lower() except AttributeError,e: return -1 try: distro_2 = m2.group(1).lower() except AttributeError,e: return 1 distro_1_ver = int(m1.group(2) or 0) distro_2_ver = int(m2.group(2) or...
def my_cmp(x,y): m1 = re.search('^(.+?)(\d{1,})?$',x) m2 = re.search('^(.+?)(\d{1,})?$',y) try: distro_1 = m1.group(1).lower() except AttributeError,e: #x has no value, it goes first return -1
params['all_distro_familys'] = [('','None Selected')] + [[osmajor,osmajor] for osmajor in sorted(e,cmp=my_cmp )]
params['all_distro_familys'] = [('','None Selected')] + [[osmajor,osmajor] for osmajor in sorted(e,cmp=self.my_cmp )]
def display(self,value=None,**params): if 'options' in params: for k in params['options'].keys(): params[k] = params['options'][k] del params['options'][k] params['all_arches'] = [[elem.arch,elem.arch] for elem in model.Arch.query()] params['all_tags'] = [['','None Selected']] + [[elem.tag,elem.tag] for elem in model.D...
query = systems
try: query = systems.outerjoin(['groups','users'], aliased=True) except AttributeError, (e): log.error('A non Query object has been passed into the available method, using default query instead: %s' % e) query = cls.query().outerjoin(['groups','users'], aliased=True)
def available(cls, user,systems=None): """ Builds on all. Only systems which this user has permission to reserve. If a system is loaned then its only available for that person. """ if systems: query = systems else: query = System.all(user) query = query.filter(and_( System.status==SystemStatus.by_name(u'Working'), ca...
case([(System.groups == None,1),(System.groups.any(User.groups.any(User.user_id == user.user_id)),1)],else_ = 0),
def available(cls, user,systems=None): """ Builds on all. Only systems which this user has permission to reserve. If a system is loaned then its only available for that person. """ if systems: query = systems else: query = System.all(user) query = query.filter(and_( System.status==SystemStatus.by_name(u'Working'), ca...
self.get_xml_attr('name', unicode, u'None')
return self.get_xml_attr('name', unicode, u'None')
def __getattr__(self, attrname): if attrname == 'name': self.get_xml_attr('name', unicode, u'None') else: raise AttributeError, attrname
print job.workflow
def __getattr__(self, attrname): if attrname == 'name': return self.get_xml_attr('name', unicode, u'None') else: raise AttributeError, attrname
print job.submitter
def __getattr__(self, attrname): if attrname == 'name': return self.get_xml_attr('name', unicode, u'None') else: raise AttributeError, attrname
self.system.activity.append(SystemActivity(self.system.user,service='Cobbler API',action='Task',new_value='Fail: %s' % e))
self.system.activity.append(SystemActivity(self.system.user,service='Cobbler API',action='Task',field_name='', new_value='Fail: %s' % e))
def wait_for_event(self, task_id): """ Wait for cobbler task to finish, return True on success raise an exception if it fails. raise an exception if it takes more then 5 minutes """ try: expiredelta = datetime.utcnow() + timedelta(minutes=10) while(True): for line in self.get_event_log(task_id).split('\n'): if line.fin...
self.user = None
def action_release(self): self.user = None # Attempt to remove Netboot entry # and turn off machine, but don't fail if we can't if self.release_action: try: self.remote.release(power=False) self.release_action.do(self) except BX, error: pass else: try: self.remote.release() except: pass
result_string = '/tasks/do_search?task=%s&result_id=%s&whiteboard=%s&arch_id=%s&' % \
result_string = '/tasks/executed?task=%s&result_id=%s&whiteboard=%s&arch_id=%s&' % \
def _create_task_list_params(self,query_obj,result): """ _create_task_list_params() takes a query obj of the type generated in generate_data() and will return a string representation of a URL pointing to a page which will display the results of the given task """ job_string = '' for job in self.job_ids: if job: job_str...
if not System.free(user).filter(System.fqdn == system).first()
if not System.free(user).filter(System.fqdn == system).first():
def queued_recipes(*args): working = SystemStatus.by_name(u'Working') recipes = Recipe.query()\ .join('status')\ .join('systems')\ .join(['recipeset','priority'])\ .filter( or_( and_(Recipe.status==TaskStatus.by_name(u'Queued'), System.user==None, System.status==working, RecipeSet.lab_controller==None ), and_(Recipe.st...
text = request.simple_cookie['column_values'].value vals_to_set = text.split(',') for elem in vals_to_set: kw['systemsearch_column_%s' % elem] = elem
if 'column_values' in request.simple_cookie: text = request.simple_cookie['column_values'].value vals_to_set = text.split(',') for elem in vals_to_set: kw['systemsearch_column_%s' % elem] = elem
def systems(self, systems, *args, **kw): # Reset joinpoint and then outerjoin on user. This is so the sort # column works in paginate/datagrid. # Also need to do distinct or paginate gets confused by the joins #log.debug(kw)
if system.current_user(our_user): options['user_change_text'] = ' (Return)' is_user = True else: title = 'New'
if system.current_user(our_user): options['user_change_text'] = ' (Return)' is_user = True
def view(self, fqdn=None, **kw): if fqdn: try: system = System.by_fqdn(fqdn,identity.current.user) except InvalidRequestError: flash( _(u"Unable to find %s" % fqdn) ) redirect("/")
if session.connection(Recipe).execute(recipe_table.update(
elif session.connection(Recipe).execute(recipe_table.update(
def queued_recipes(*args): working = SystemStatus.by_name(u'Working') recipes = Recipe.query()\ .join('status')\ .join('systems')\ .join(['recipeset','priority'])\ .filter( or_( and_(Recipe.status==TaskStatus.by_name(u'Queued'), System.user==None, System.status==working, RecipeSet.lab_controller==None ), and_(Recipe.st...
return (joins, and_(*queries))
if queries: return (joins, and_(*queries)) else: return ([],None)
def filter(self): queries = [] joins = [] for child in self: if callable(getattr(child, 'filter', None)): (join, query) = child.filter() queries.append(query) joins.extend(join) return (joins, and_(*queries))
return (joins, or_(*queries))
if queries: return (joins, or_(*queries)) else: return ([],None)
def filter(self): queries = [] joins = [] for child in self: if callable(getattr(child, 'filter', None)): (join, query) = child.filter() queries.append(query) joins.extend(join) return (joins, or_(*queries))
def handle_partition(self, partition): fs = None type = 'part' name = 'testarea' size = '5' for child in partition.childNodes:
def handle_partition(self, node): partition = self.doc.createElement('partition') for child in node.childNodes:
def handle_partition(self, partition): fs = None type = 'part' name = 'testarea' size = '5' for child in partition.childNodes: if child.nodeName == 'type': type = self.getText(child.childNodes) if child.nodeName == 'name': name = self.getText(child.childNodes) if child.nodeName == 'size': size = self.getText(child.chil...
type = self.getText(child.childNodes)
partition.setAttribute('type', self.getText(child.childNodes))
def handle_partition(self, partition): fs = None type = 'part' name = 'testarea' size = '5' for child in partition.childNodes: if child.nodeName == 'type': type = self.getText(child.childNodes) if child.nodeName == 'name': name = self.getText(child.childNodes) if child.nodeName == 'size': size = self.getText(child.chil...
name = self.getText(child.childNodes)
partition.setAttribute('name', self.getText(child.childNodes))
def handle_partition(self, partition): fs = None type = 'part' name = 'testarea' size = '5' for child in partition.childNodes: if child.nodeName == 'type': type = self.getText(child.childNodes) if child.nodeName == 'name': name = self.getText(child.childNodes) if child.nodeName == 'size': size = self.getText(child.chil...
size = self.getText(child.childNodes)
partition.setAttribute('size', self.getText(child.childNodes))
def handle_partition(self, partition): fs = None type = 'part' name = 'testarea' size = '5' for child in partition.childNodes: if child.nodeName == 'type': type = self.getText(child.childNodes) if child.nodeName == 'name': name = self.getText(child.childNodes) if child.nodeName == 'size': size = self.getText(child.chil...
fs = self.getText(child.childNodes) part_str = '%s:%s:%s' % (name,type,size) if fs: part_str = '%s:%s' % (part_str, fs) return part_str
partition.setAttribute('fs', self.getText(child.childNodes)) return partition
def handle_partition(self, partition): fs = None type = 'part' name = 'testarea' size = '5' for child in partition.childNodes: if child.nodeName == 'type': type = self.getText(child.childNodes) if child.nodeName == 'name': name = self.getText(child.childNodes) if child.nodeName == 'size': size = self.getText(child.chil...
if 'watchdog' in self.wrappedEl:
if hasattr(self.wrappedEl, 'watchdog'):
def __getattr__(self, attrname): if attrname == 'arch': return self.get_xml_attr('arch', unicode, None) elif attrname == 'id': return self.get_xml_attr('id', int, 0) elif attrname == 'recipe_set_id': return self.get_xml_attr('recipe_set_id', int, 0) elif attrname == 'job_id': return self.get_xml_attr('job_id', int, 0) ...
except: item = cls(**kwargs) session.save(item) session.flush([item])
except InvalidRequestError, e: if e == 'Multiple rows returned for one()': log.error('Mutlitple rows returned for %s' % kwargs) elif e == 'No rows returned for one()': item = cls(**kwargs) session.save(item) session.flush([item])
def lazy_create(cls, **kwargs): try: item = cls.query.filter_by(**kwargs).one() except: item = cls(**kwargs) session.save(item) session.flush([item]) return item
class Utility:
def get_widget_attrs(table,column,with_desc=True,sortable=False,index=None): options = {} lower_column = column.lower() lower_table = table.lower()
systems = sys_search.return_results() new_systems = System.all(identity.current.user,system = systems) return new_systems
return sys_search.return_results()
def _system_search(self,kw,sys_search,use_custom_columns = False): for search in kw['systemsearch']: #clsinfo = System.get_dict()[search['table']] #Need to change this class_field_list = search['table'].split('/') cls_ref = search_utility.SystemSearch.translate_name(class_field_list[0]) col = class_field_list[1] #If va...
javascript = []
javascript = [ LocalJSLink('bkr','/static/javascript/jquery-1.3.1.js'), ]
def __init__(self,*args,**kw): self.priority_widget = PriorityWidget() if 'recipeset' in kw: self.recipeset = kw['recipeset'] else: self.recipeset = None
return_dict['keyvals'] = Key.get_all_keys()
return_dict['keyvals'] = [x for x in Key.get_all_keys() if x != 'MODULE']
def get_keyvalue_search_options(self,**kw): return_dict = {} return_dict['keyvals'] = Key.get_all_keys() return return_dict
self.watchdogs[watchdog['system']] = Monitor(watchdog,self.logger,self.conf)
self.watchdogs[watchdog['system']] = Monitor(watchdog,self.logger,self.conf,self.hub)
def active_watchdogs(self): """Monitor active watchdog entries"""
def __init__(self, watchdog, logger, conf, *args, **kwargs):
def __init__(self, watchdog, logger, conf, hub, *args, **kwargs):
def __init__(self, watchdog, logger, conf, *args, **kwargs): """ Monitor system """ self.log = logger self.conf = conf self.watchdog = watchdog self.logger.debug("Initialize monitor for system: %s" % self.watchdog['system']) self.watchedFiles = [WatchFile("%s/%s" % (self.conf["CONSOLE_LOGS"], self.watchdog["system"]),s...
self.log = logger
self.logger = logger
def __init__(self, watchdog, logger, conf, *args, **kwargs): """ Monitor system """ self.log = logger self.conf = conf self.watchdog = watchdog self.logger.debug("Initialize monitor for system: %s" % self.watchdog['system']) self.watchedFiles = [WatchFile("%s/%s" % (self.conf["CONSOLE_LOGS"], self.watchdog["system"]),s...
return "%s/%02d/%s/%s" % (self.recipeset.queue_time.year, int(str(job.id)[-2:]), job.id, self.id)
return "%s/%02d/%s/%s/%s" % (self.recipeset.queue_time.year, self.recipeset.queue_time.month, job.id // Log.MAX_ENTRIES_PER_DIRECTORY, job.id, self.id)
def filepath(self): """ Return file path for this recipe """ job = self.recipeset.job return "%s/%02d/%s/%s" % (self.recipeset.queue_time.year, int(str(job.id)[-2:]), job.id, self.id)
return "%s/%02d/%s/%s/%s" % (recipe.recipeset.queue_time.year, int(str(job.id)[-2:]), job.id, recipe.id, self.id)
return "%s/%02d/%s/%s/%s/%s" % (recipe.recipeset.queue_time.year, recipe.recipeset.queue_time.month, job.id // Log.MAX_ENTRIES_PER_DIRECTORY, job.id, recipe.id, self.id)
def filepath(self): """ Return file path for this task """ job = self.recipe.recipeset.job recipe = self.recipe return "%s/%02d/%s/%s/%s" % (recipe.recipeset.queue_time.year, int(str(job.id)[-2:]), job.id, recipe.id, self.id)
return "%s/%02d/%s/%s/%s/%s" % (recipe.recipeset.queue_time.year, int(str(job.id)[-2:]), job.id, recipe.id, task_id, self.id)
return "%s/%02d/%s/%s/%s/%s/%s" % (recipe.recipeset.queue_time.year, recipe.recipeset.queue_time.month, job.id // Log.MAX_ENTRIES_PER_DIRECTORY, job.id, recipe.id, task_id, self.id)
def filepath(self): """ Return file path for this result """ job = self.recipetask.recipe.recipeset.job recipe = self.recipetask.recipe task_id = self.recipetask.id return "%s/%02d/%s/%s/%s/%s" % (recipe.recipeset.queue_time.year, int(str(job.id)[-2:]), job.id, recipe.id, task_id, self.id)
if self.distro.arch in recipetasks.excluded_arch:
if self.distro.arch in recipetask.task.excluded_arch:
def append_tasks(self, recipetask): """ Before appending the task to this Recipe, make sure it applies. ie: not excluded for this distro family or arch. """ if self.distro.arch in recipetasks.excluded_arch: return if self.distro.osmajor in recipetasks.excluded_osmajor: return self.tasks.append(recipetask)
if self.distro.osmajor in recipetasks.excluded_osmajor:
if self.distro.osversion.osmajor in recipetask.task.excluded_osmajor:
def append_tasks(self, recipetask): """ Before appending the task to this Recipe, make sure it applies. ie: not excluded for this distro family or arch. """ if self.distro.arch in recipetasks.excluded_arch: return if self.distro.osmajor in recipetasks.excluded_osmajor: return self.tasks.append(recipetask)
distro_virt.setAttribute("value", True)
distro_virt.setAttribute("value", "1")
def _get_distro_requires(self): drs = xml.dom.minidom.parseString(self._distro_requires) # If no distro_virt is asked for default to Virt if not drs.getElementsByTagName("distro_virt"): distroRequires = self.doc.createElement("distroRequires") for dr in drs.getElementsByTagName("distroRequires"): for child in dr.childN...
recipeSet.appendChild(r.to_xml(clone, from_recipeset=True))
if not isinstance(r,GuestRecipe): recipeSet.appendChild(r.to_xml(clone, from_recipeset=True))
def to_xml(self, clone=False): recipeSet = self.doc.createElement("recipeSet") if not clone: recipeSet.setAttribute("id", "%s" % self.id) for r in self.recipes: recipeSet.appendChild(r.to_xml(clone, from_recipeset=True)) return recipeSet
if not from_recipeset:
if not from_recipeset and not isinstance(self, GuestRecipe):
def to_xml(self, recipe, clone=False, from_recipeset=False): if not clone: recipe.setAttribute("id", "%s" % self.id) recipe.setAttribute("job_id", "%s" % self.recipeset.job_id) recipe.setAttribute("recipe_set_id", "%s" % self.recipe_set_id) recipe.setAttribute("whiteboard", "%s" % self.whiteboard and self.whiteboard or...
systems = recipe.dyn_systems.filter(System.user==None)
systems = recipe.dyn_systems.filter(and_(System.user==None, System.status==working))
def queued_recipes(*args): recipes = Recipe.query()\ .join('status')\ .join('systems')\ .join(['recipeset','priority'])\ .filter( or_( and_(Recipe.status==TaskStatus.by_name(u'Queued'), System.user==None, RecipeSet.lab_controller==None ), and_(Recipe.status==TaskStatus.by_name(u'Queued'), System.user==None, RecipeSet.l...
else
else:
def has_access(self, user): """ Given a user return True if that user has access to this system """ # If a system is loaned its available exclusively to that user if self.loaned != None: if self.loaned == self.user: return True else return False # If were the owner and its not loaned we have access. if self.owner == us...
if self.distro.arch in recipetask.task.excluded_arch:
if self.distro.arch in [arch.arch for arch in recipetask.task.excluded_arch]:
def append_tasks(self, recipetask): """ Before appending the task to this Recipe, make sure it applies. ie: not excluded for this distro family or arch. """ if self.distro.arch in recipetask.task.excluded_arch: return if self.distro.osversion.osmajor in recipetask.task.excluded_osmajor: return self.tasks.append(recipet...
if self.distro.osversion.osmajor in recipetask.task.excluded_osmajor:
if self.distro.osversion.osmajor in [osmajor.osmajor for osmajor in recipetask.task.excluded_osmajor]:
def append_tasks(self, recipetask): """ Before appending the task to this Recipe, make sure it applies. ie: not excluded for this distro family or arch. """ if self.distro.arch in recipetask.task.excluded_arch: return if self.distro.osversion.osmajor in recipetask.task.excluded_osmajor: return self.tasks.append(recipet...
return self.hub.legacypush(fqdn, inventory)
return self.hub.push(fqdn, inventory)
def push(self, fqdn, inventory): """ Push inventory data to Scheduler """ return self.hub.legacypush(fqdn, inventory)
arch_table.c.id == system_arch_map.c.arch_id] query = getattr(arch_table.c.arch, op)(value)
alias.c.id == system_arch_map.c.arch_id] query = getattr(alias.c.arch, op)(value)
def filter(self): op = self.op_table[self.get_xml_attr('op', unicode, '==')] value = self.get_xml_attr('value', unicode, None) joins = [] query = None if value: joins = [system_table.c.id == system_arch_map.c.system_id, arch_table.c.id == system_arch_map.c.arch_id] query = getattr(arch_table.c.arch, op)(value) return...
return cls._opposites_is_not_filter(x,y)
wildcard_y = re.sub('\*','%',y) if wildcard_y != y: arches = model.Arch.query().filter(model.Arch.arch.like(wildcard_y)) arch_ids = [arch.id for arch in arches] if not arch_ids: return 'True' wildcard = True y = wildcard_y else: try: valid_arch = model.Arch.query().filter(model.Arch.arch == y).one() wildcard = False e...
def arch_is_not_filter(cls,x,y): return cls._opposites_is_not_filter(x,y)
return cls._opposites_is_not_filter(x,y) @classmethod def _opposites_is_not_filter(cls,x,y):
def distro_is_not_filter(cls,x,y): return cls._opposites_is_not_filter(x,y)
if wildcard_y != y: return x.like(wildcard_y)
if wildcard_y != y: osmajors = model.OSMajor.query().filter(model.OSMajor.osmajor.like(wildcard_y)) osmajor_ids = [osmajor.id for osmajor in osmajors] if not osmajor_ids: return 'True' wildcard = True y = wildcard_y else: try: model.OSMajor.query().filter(model.OSMajor.osmajor == y).one() wildcard = False except: retur...
def _opposites_is_not_filter(cls,x,y): wildcard_y = re.sub('\*','%',y) if wildcard_y != y: #looks like we found a wildcard return x.like(wildcard_y) if not y: return or_(x == None,x==y) return x == y
redirect("/recipes/view?id=%s" % system.watchdog.recipe_id)
redirect("/recipes/%s" % system.watchdog.recipe_id)
def user_change(self, id): msg = "" status = None activity = None try: system = System.by_id(id,identity.current.user) except InvalidRequestError: flash( _(u"Unable to find system with id of %s" % id) ) redirect("/") if system.user: if system.user == identity.current.user or \ identity.current.user.is_admin(): # Don't ...
turbomail.enqueue(message)
turbomail.send(message)
def send_mail(sender, to, subject, body): from turbomail import MailNotEnabledException message = turbomail.Message(sender, to, subject) message.plain = body try: #log.debug("Sending mail: %s" % message.plain) turbomail.enqueue(message) except MailNotEnabledException: log.warning("TurboMail is not enabled!") except Exc...
for recipe in job.recipes: if recipe.is_failed(): msg = "%s\tRecipeID: %s Arch: %s System: %s Distro: %s OSVersion: Status: %s Result: %s\n" \ % (msg, recipe.id, recipe.distro.arch, recipe.system, recipe.distro, recipe.distro.osversion, recipe.status, recipe.result) for task in recipe.tasks: if task.is_failed(): msg = ...
for recipeset in job.recipesets: if recipeset.is_failed(): msg = "%s\tRecipeSetID: %s\n" % ( msg, recipeset.id ) for recipe in recipeset.recipes: if recipe.is_failed(): msg = "%s\t\tRecipeID: %s Arch: %s System: %s Distro: %s OSVersion: %s Status: %s Result: %s\n" \ % (msg, recipe.id, recipe.distro.arch, recipe.system,...
def failed_recipes(job): msg = "JobID: %s Status: %s Result: %s\n" % \ (job.id, job.status, job.result) for recipe in job.recipes: if recipe.is_failed(): msg = "%s\tRecipeID: %s Arch: %s System: %s Distro: %s OSVersion: Status: %s Result: %s\n" \ % (msg, recipe.id, recipe.distro.arch, recipe.system, recipe.distro, reci...
recipes = model.MachineRecipe.query().join(['distro','arch']).join(['recipeset','job']).filter(model.RecipeSet.job_id.in_(jobs)).add_column(model.Arch.arch)
recipes = model.Recipe.query().join(['distro','arch']).join(['recipeset','job']).filter(model.RecipeSet.job_id.in_(jobs)).add_column(model.Arch.arch)
def generate_data(self,**kw): """ generate_data() returns a nested tuple which represents tasks->arches->whiteboards and their data objects """ jobs = [] self.arches_used = {} self.whiteboards_used = {} whiteboard_data = {} if 'job_ids' in kw: jobs = kw['job_ids'].split() elif 'whiteboard' in kw: job_query = model.Job....
m = Modeller() log.debug('field type is %s' % type)
m = Modeller()
def search_operators(cls,type,loose_match=None): m = Modeller() log.debug('field type is %s' % type) operators = m.return_operators(type,loose_match) return operators
if ks_meta: ks_meta = "%s ks_appends=True" else: ks_meta = "ks_appends=True"
ks_meta['ks_appends'] = True
def provision(self, distro=None, kickstart=None, ks_meta=None, kernel_options=None, kernel_options_post=None, ks_appends=None): """ Provision the System make xmlrpc call to lab controller """ if not distro: return False
return dict(grid=grid,list=systems,title='Systems for group %s' % group.group_name,search_bar = None)
return dict(grid=grid,list=systems,title='Systems for group %s' % group.group_name,search_bar = None,object_count=systems.count())
def systems(self,group_id,*args,**kw): systems = System.by_group(group_id) system_link = ('System', lambda x: x.link) group = Group.by_id(group_id) grid = myDataGrid(fields=[system_link]) return dict(grid=grid,list=systems,title='Systems for group %s' % group.group_name,search_bar = None)
print name + ','
print '"%s",' % name
def show_brief(nm, arch): if type(arch.toc) == type({}): toc = arch.toc for name,_ in toc.items(): print name + ',' else: print '[' toc = arch.toc.data for el in toc: print el[5] + ',' if rec_debug: if el[4] == 'z' or el[4] == 'a': show_brief(el[5], getArchive(el[5])) stack.pop() print ']'
print el[5] + ','
print '"%s",' % el[5]
def show_brief(nm, arch): if type(arch.toc) == type({}): toc = arch.toc for name,_ in toc.items(): print name + ',' else: print '[' toc = arch.toc.data for el in toc: print el[5] + ',' if rec_debug: if el[4] == 'z' or el[4] == 'a': show_brief(el[5], getArchive(el[5])) stack.pop() print ']'
cmd = "strip \"%s\"" % cachedfile
cmd = "strip -S \"%s\"" % cachedfile
def checkCache(fnm, strip, upx): # On darwin a cache is required anyway to keep the libaries # with relative install names if (not strip and not upx and sys.platform[:6] != 'darwin' and sys.platform != 'win32') or fnm.lower().endswith(".manifest"): return fnm if strip: strip = 1 else: strip = 0 if upx: upx = 1 else: up...
j = vs.fromRaw(data)
j = vs.fromRaw(data, pe)
def decode(pathnm): h = win32api.LoadLibraryEx(pathnm, 0, LOAD_LIBRARY_AS_DATAFILE) nm = win32api.EnumResourceNames(h, RT_VERSION)[0] data = win32api.LoadResource(h, RT_VERSION, nm) vs = VSVersionInfo() j = vs.fromRaw(data) if TEST: print vs if data[:j] != vs.toRaw(): print "AAAAAGGHHHH" txt = repr(vs) glbls = {} glbls...
def fromRaw(self, data):
def fromRaw(self, data, pe=None):
def fromRaw(self, data): i, (sublen, vallen, wType, nm) = parseCommon(data) #vallen is length of the ffi, typ is 0, nm is 'VS_VERSION_INFO' i = ((i + 3) / 4) * 4 # now a VS_FIXEDFILEINFO self.ffi = FixedFileInfo() j = self.ffi.fromRaw(data, i) #print ffi if TEST: if data[i:j] != self.ffi.toRaw(): print "raw:", `data[i:...
j = self.ffi.fromRaw(data, i)
j = self.ffi.fromRaw(data, i, pe)
def fromRaw(self, data): i, (sublen, vallen, wType, nm) = parseCommon(data) #vallen is length of the ffi, typ is 0, nm is 'VS_VERSION_INFO' i = ((i + 3) / 4) * 4 # now a VS_FIXEDFILEINFO self.ffi = FixedFileInfo() j = self.ffi.fromRaw(data, i) #print ffi if TEST: if data[i:j] != self.ffi.toRaw(): print "raw:", `data[i:...
def fromRaw(self, data, i): (self.sig, self.strucVersion, self.fileVersionMS, self.fileVersionLS, self.productVersionMS, self.productVersionLS, self.fileFlagsMask, self.fileFlags, self.fileOS, self.fileType, self.fileSubtype, self.fileDateMS, self.fileDateLS) = struct.unpack('13l', data[i:i+52])
def fromRaw(self, data, i, pe=None): if hasattr(pe, 'VS_FIXEDFILEINFO'): info = pe.VS_FIXEDFILEINFO self.sig = info.Signature print 'type self.sig:', type(self.sig) self.strucVersion = info.StrucVersion self.fileVersionMS = info.FileVersionMS self.fileVersionLS = info.FileVersionLS self.productVersionMS = info.ProductV...
def fromRaw(self, data, i): (self.sig, self.strucVersion, self.fileVersionMS, self.fileVersionLS, self.productVersionMS, self.productVersionLS, self.fileFlagsMask, self.fileFlags, self.fileOS, self.fileType, self.fileSubtype, self.fileDateMS, self.fileDateLS) = struct.unpack('13l', data[i:i+52]) return i+52
if target_iswin: exe = exe + "_" is24 = hasattr(sys, "version_info") and sys.version_info[:2] >= (2,4) exe = exe + "67"[is24] exe = exe + "rd"[self.debug] exe = exe + "wc"[self.console] else: if not self.console: exe = exe + 'w' if self.debug: exe = exe + '_d'
if not self.console: exe = exe + 'w' if self.debug: exe = exe + '_d'
def _bootloader_postfix(self, exe): if target_iswin: exe = exe + "_" is24 = hasattr(sys, "version_info") and sys.version_info[:2] >= (2,4) exe = exe + "67"[is24] exe = exe + "rd"[self.debug] exe = exe + "wc"[self.console] else: if not self.console: exe = exe + 'w' if self.debug: exe = exe + '_d' return exe
sys.pathex = pathex[:]
sys.pathex = self.pathex[:]
def __init__(self, scripts=None, pathex=None, hookspath=None, excludes=None): Target.__init__(self) self.inputs = scripts for script in scripts: if not os.path.exists(script): raise ValueError, "script '%s' not found" % script self.pathex = [] if pathex: for path in pathex: self.pathex.append(absnormpath(path)) sys.pat...
if pyasm:
if os.path.altsep: fnm = fnm.replace(os.path.altsep, os.path.sep) if pyasm and os.path.dirname(fnm.lower()) != os.path.join(HOMEPATH.lower(), "support", "loader"):
def checkCache(fnm, strip, upx): # On darwin a cache is required anyway to keep the libaries # with relative install names if not strip and not upx and sys.platform != 'darwin' and sys.platform != 'win32': return fnm global winresource, winmanifest if strip: strip = 1 else: strip = 0 if upx: upx = 1 else: upx = 0 # Lo...
JUMP_IF_FALSE = dis.opname.index('JUMP_IF_FALSE') JUMP_IF_TRUE = dis.opname.index('JUMP_IF_TRUE')
if getattr(sys, 'version_info', (0,0,0)) >= (2,7,0): COND_OPS = [dis.opname.index('POP_JUMP_IF_TRUE'), dis.opname.index('POP_JUMP_IF_FALSE'), dis.opname.index('JUMP_IF_TRUE_OR_POP'), dis.opname.index('JUMP_IF_FALSE_OR_POP'), ] else: COND_OPS = [dis.opname.index('JUMP_IF_FALSE'), dis.opname.index('JUMP_IF_TRUE'), ]
def doimport(self, nm): mod = self.owner.getmod(self.__name__ + '.' + nm) return mod
COND_OPS = [JUMP_IF_TRUE, JUMP_IF_FALSE] STORE_OPS = [STORE_NAME, STORE_FAST, STORE_GLOBAL, STORE_DEREF]
STORE_OPS = [STORE_NAME, STORE_FAST, STORE_GLOBAL, STORE_DEREF, STORE_MAP]
def doimport(self, nm): mod = self.owner.getmod(self.__name__ + '.' + nm) return mod
out = i + oparg
out = oparg if op in dis.hasjrel: out += i
def pass1(code): instrs = [] i = 0 n = len(code) curline = 0 incondition = 0 out = 0 while i < n: if i >= out: incondition = 0 c = code[i] i = i+1 op = ord(c) if op >= dis.HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 else: oparg = None if not incondition and op in COND_OPS: incondition = 1 out = i +...
elif op == IMPORT_STAR:
elif op == IMPORT_STAR: assert lastname is not None
def scan_code(co, m=None, w=None, b=None, nested=0): instrs = pass1(co.co_code) if m is None: m = [] if w is None: w = [] if b is None: b = [] all = None lastname = None level = -1 # import-level, same behaviour as up to Python 2.4 for i in range(len(instrs)): op, oparg, conditional, curline = instrs[i] if op == IMPORT...
if isinstance(self.manifest, manifest.Manifest):
if isinstance(self.manifest, winmanifest.Manifest):
def assemble(self): print "building EXE from", os.path.basename(self.out) trash = [] if not os.path.exists(os.path.dirname(self.name)): os.makedirs(os.path.dirname(self.name)) outf = open(self.name, 'wb') exe = self._bootloader_postfix('support/loader/run') exe = os.path.join(HOMEPATH, exe) if target_iswin or cygwin: e...
import pyi_optparse as optparsae
import pyi_optparse as optparse
def main(): global global_opts global opts import pyi_optparse as optparsae cmds = {} p = optparse.OptionParser( usage="%prog [opts] file", description="Generate a plaintext keyfile containing a " "random-generated encryption key. ") cmds["genkey"] = p for c,p in cmds.items(): p.prog = p.get_prog_name() + " " + c cm...
if not strip and not upx and sys.platform != 'darwin':
if not strip and not upx and sys.platform != 'darwin' and sys.platform != 'win32':
def checkCache(fnm, strip, upx): # On darwin a cache is required anyway to keep the libaries # with relative install names if not strip and not upx and sys.platform != 'darwin': return fnm if strip: strip = 1 else: strip = 0 if upx: upx = 1 else: upx = 0 # Load cache index cachedir = os.path.join(HOMEPATH, 'bincache%d...
if nm.lower() == (assembly.name + ".dll").lower(): ftocnm = nm else: ftocnm = os.path.join(assembly.name, nm)
ftocnm = nm
def selectAssemblies(pth): """Return a binary's dependent assemblies files that should be included. Return a list of pairs (name, fullpath) """ rv = [] if not os.path.isfile(pth): pth = check_extract_from_egg(pth)[0][0] for assembly in getAssemblies(pth): if excludesRe.search(assembly.name): if not silent: print "I: S...
if fromlist is None:
if not fromlist:
def importHook(self, name, globals=None, locals=None, fromlist=None, level=-1): __globals_name = None if globals: __globals_name = globals.get('__name__') # first see if we could be importing a relative name debug("importHook(%s, %s, locals, %s, %s)" % (name, __globals_name, fromlist, level)) _sys_modules_get = sys.mod...
show(name, arch)
show(name, arch, debug, name + '.log')
def main(): global stack name = sys.argv[1] arch = getArchive(name) stack.append((name, arch)) show(name, arch) while 1: try: toks = string.split(raw_input('? '), None, 1) except EOFError: # Ctrl-D print # clear line break if not toks: usage() continue if len(toks) == 1: cmd = toks[0] arg = '' else: cmd, arg = toks cm...
show(nm, arch)
show(nm, arch, debug, name + '.' + nm + '.log')
def main(): global stack name = sys.argv[1] arch = getArchive(name) stack.append((name, arch)) show(name, arch) while 1: try: toks = string.split(raw_input('? '), None, 1) except EOFError: # Ctrl-D print # clear line break if not toks: usage() continue if len(toks) == 1: cmd = toks[0] arg = '' else: cmd, arg = toks cm...
show(arg, arch)
show(arg, arch, debug, name + '.' + arg + '.log')
def main(): global stack name = sys.argv[1] arch = getArchive(name) stack.append((name, arch)) show(name, arch) while 1: try: toks = string.split(raw_input('? '), None, 1) except EOFError: # Ctrl-D print # clear line break if not toks: usage() continue if len(toks) == 1: cmd = toks[0] arg = '' else: cmd, arg = toks cm...
def show(nm, arch):
def show(nm, arch, onfile=False, fn=None):
def show(nm, arch): if type(arch.toc) == type({}): print " Name: (ispkg, pos, len)" toc = arch.toc else: print " pos, length, uncompressed, iscompressed, type, name" toc = arch.toc.data pprint.pprint(toc)
opts.pathex.extend(string.split(p, os.pathsep))
opts.pathex.extend(p.split(os.pathsep))
def run_makespec(opts, args): # Split pathex by using the path separator temppaths = opts.pathex[:] opts.pathex = [] for p in temppaths: opts.pathex.extend(string.split(p, os.pathsep)) spec_file = Makespec.main(args, **opts.__dict__) print "wrote %s" % spec_file return spec_file
if pyasm and os.path.dirname(fnm.lower()) != os.path.join(HOMEPATH.lower(), "support", "loader"):
if pyasm and not fnm.lower().startswith("bincache") and \ os.path.dirname(fnm.lower()) not in (os.path.join(HOMEPATH.lower(), "support", "loader"), tempfile.gettempdir().lower()):
def checkCache(fnm, strip, upx): # On darwin a cache is required anyway to keep the libaries # with relative install names if not strip and not upx and sys.platform != 'darwin' and sys.platform != 'win32': return fnm global winresource, winmanifest if strip: strip = 1 else: strip = 0 if upx: upx = 1 else: upx = 0 # Lo...
manifest.update_resources(cachedfile, [name], [language])
try: manifest.update_resources(os.path.abspath(cachedfile), [name], [language]) except Exception, e: print "E:", os.path.abspath(cachedfile) raise
def checkCache(fnm, strip, upx): # On darwin a cache is required anyway to keep the libaries # with relative install names if not strip and not upx and sys.platform != 'darwin' and sys.platform != 'win32': return fnm global winresource, winmanifest if strip: strip = 1 else: strip = 0 if upx: upx = 1 else: upx = 0 # Lo...
pattern_list = eval(open(newlog, 'r').read())
pattern_list = eval(open(logfn, 'r').read())
def runtests(alltests, filters=None, configfile=None, run_executable=1, verbose=False): info = "Executing PyInstaller tests in: %s" % os.getcwd() print "*" * min(80, len(info)) print info print "*" * min(80, len(info)) OPTS = '' if configfile: # todo: quote correctly OTPS = ' -c "%s"' % configfile build_python = ope...
print "MISSING: %s" % pattern
if verbose: print "MISSING: %s" % pattern
def runtests(alltests, filters=None, configfile=None, run_executable=1, verbose=False): info = "Executing PyInstaller tests in: %s" % os.getcwd() print "*" * min(80, len(info)) print info print "*" * min(80, len(info)) OPTS = '' if configfile: # todo: quote correctly OTPS = ' -c "%s"' % configfile build_python = ope...
paths.extend(glob(os.path.join(dirnm, self.name)))
paths.extend(glob(os.path.join(dirnm, self.name + ext)))
def find_files(self, ignore_policies=True): """ Search shared and private assemblies and return a list of files. If any files are not found, return an empty list. IMPORTANT NOTE: For the purpose of getting the dependent assembly files of an executable, the publisher configuration (aka policy) should be ignored (which...