Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 893846 Details for
Bug 1096017
[RFE] add or logic to support complicated hostrequire
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
0001-add-or-logic-to-support-complicated-hostrequire.patch
0001-add-or-logic-to-support-complicated-hostrequire.patch (text/plain), 5.52 KB, created by
Zhenjie Chen
on 2014-05-09 06:02:59 UTC
(
hide
)
Description:
0001-add-or-logic-to-support-complicated-hostrequire.patch
Filename:
MIME Type:
Creator:
Zhenjie Chen
Created:
2014-05-09 06:02:59 UTC
Size:
5.52 KB
patch
obsolete
>From 6e5a1bd673d51e9e10f479e6cd0dededf28823e1 Mon Sep 17 00:00:00 2001 >From: Zhenjie Chen <zhchen@redhat.com> >Date: Fri, 9 May 2014 13:34:46 +0800 >Subject: [PATCH] add or logic to support complicated hostrequire > >--- > Client/src/bkr/client/__init__.py | 49 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > >diff --git a/Client/src/bkr/client/__init__.py b/Client/src/bkr/client/__init__.py >index 99576c8..53eec59 100644 >--- a/Client/src/bkr/client/__init__.py >+++ b/Client/src/bkr/client/__init__.py >@@ -197,12 +197,24 @@ def options(self): > help="Additional <hostRequires/> for job (example: labcontroller=lab.example.com)", > ) > system_options.add_option( >+ "--orhostrequire", metavar='"TAG OPERATOR VALUE"', >+ action="append", >+ default=[], >+ help="Additional <orhostRequires/> for job (example: labcontroller=lab.example.com)", >+ ) >+ system_options.add_option( > "--keyvalue", metavar='"KEY OPERATOR VALUE"', > action="append", > default=[], > help="Require system with matching legacy key-value (example: NETWORK=e1000)", > ) > system_options.add_option( >+ "--orkeyvalue", metavar='"KEY OPERATOR VALUE"', >+ action="append", >+ default=[], >+ help="or Require system with matching legacy key-value (example: NETWORK=e1000)", >+ ) >+ system_options.add_option( > "--random", > default=False, > action="store_true", >@@ -593,12 +605,14 @@ def __init__(self, *args, **kwargs): > self.node.setAttribute('whiteboard','') > andDistroRequires = self.doc.createElement('and') > andHostRequires = self.doc.createElement('and') >+ orHostRequires = self.doc.createElement('or') > partitions = self.doc.createElement('partitions') > distroRequires = self.doc.createElement('distroRequires') > hostRequires = self.doc.createElement('hostRequires') > repos = self.doc.createElement('repos') > distroRequires.appendChild(andDistroRequires) > hostRequires.appendChild(andHostRequires) >+ hostRequires.appendChild(orHostRequires) > self.node.appendChild(distroRequires) > self.node.appendChild(hostRequires) > self.node.appendChild(repos) >@@ -618,7 +632,9 @@ def addBaseRequires(self, *args, **kwargs): > systype = kwargs.get("systype", None) > machine = kwargs.get("machine", None) > keyvalues = kwargs.get("keyvalue", []) >+ orkeyvalues = kwargs.get("orkeyvalue", []) > requires = kwargs.get("hostrequire", []) >+ orrequires = kwargs.get("orhostrequire", []) > repos = kwargs.get("repo", []) > postrepos = kwargs.get("repo_post", []) > random = kwargs.get("random", False) >@@ -682,12 +698,25 @@ def addBaseRequires(self, *args, **kwargs): > mykeyvalue.setAttribute('op', '%s' % op) > mykeyvalue.setAttribute('value', '%s' % value) > self.addHostRequires(mykeyvalue) >+ for keyvalue in orkeyvalues: >+ key, op, value = p2.split(keyvalue,3) >+ mykeyvalue = self.doc.createElement('key_value') >+ mykeyvalue.setAttribute('key', '%s' % key) >+ mykeyvalue.setAttribute('op', '%s' % op) >+ mykeyvalue.setAttribute('value', '%s' % value) >+ self.addOrHostRequires(mykeyvalue) > for require in requires: > key, op, value = p2.split(require,3) > myrequire = self.doc.createElement('%s' % key) > myrequire.setAttribute('op', '%s' % op) > myrequire.setAttribute('value', '%s' % value) > self.addHostRequires(myrequire) >+ for require in orrequires: >+ key, op, value = p2.split(require,3) >+ myrequire = self.doc.createElement('%s' % key) >+ myrequire.setAttribute('op', '%s' % op) >+ myrequire.setAttribute('value', '%s' % value) >+ self.addOrHostRequires(myrequire) > > if random: > self.addAutopick(random) >@@ -738,6 +767,20 @@ def addHostRequires(self, nodes): > if isinstance(node, xml.dom.minidom.Element): > self.andHostRequires.appendChild(node.cloneNode(True)) > >+ def addOrHostRequires(self, nodes): >+ """ Accepts either xml, dom.Element or a list of dom.Elements """ >+ if isinstance(nodes, str): >+ parse = xml.dom.minidom.parseString(nodes.strip()) >+ nodes = [] >+ for node in parse.getElementsByTagName("hostRequires"): >+ nodes.extend(node.childNodes) >+ elif isinstance(nodes, xml.dom.minidom.Element): >+ nodes = [nodes] >+ if isinstance(nodes, list): >+ for node in nodes: >+ if isinstance(node, xml.dom.minidom.Element): >+ self.orHostRequires.appendChild(node.cloneNode(True)) >+ > def addDistroRequires(self, nodes): > """ Accepts either xml, dom.Element or a list of dom.Elements """ > if isinstance(nodes, str): >@@ -844,6 +887,12 @@ def get_andHostRequires(self): > .getElementsByTagName('and')[0] > andHostRequires = property(get_andHostRequires) > >+ def get_orHostRequires(self): >+ return self.node\ >+ .getElementsByTagName('hostRequires')[0]\ >+ .getElementsByTagName('or')[0] >+ orHostRequires = property(get_orHostRequires) >+ > def get_repos(self): > return self.node.getElementsByTagName('repos')[0] > repos = property(get_repos) >-- >1.9.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1096017
: 893846