Skip to contentSkip to conversation

mg-hosts: Allow spaces in setflagexpr exprs

PATCH In review Ian Jackson 2 participants 5 messages Jun 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mg-hosts: Allow spaces in setflagexpr exprs

---
 mg-hosts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mg-hosts +1 -1
index d7223a1..c116688 100755
@@ -321,7 +321,7 @@ END
 	my ($dst,$section) = @_;
 	die unless @$section == 2;
 	my ($dstflag, $expr) = @$section;
-	die "$expr $& ?" if $expr =~ m/[^-0-9a-z_&|()!~]/;
+	die "$expr $& ?" if $expr =~ m/[^-0-9a-z_&|()!~ \t]/;
 
 	my %inputs;
 	$expr =~ s{[-0-9a-z_]+}{
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 mg-hosts: Usage documentation.

---
 mg-hosts |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
mg-hosts +65 -0
index c116688..0e889f5 100755
@@ -17,6 +17,71 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
+# Usages:
+#
+#  ./mg-hosts mkpxedir HOST...
+#               Create directories for pxeboot as expected by the rest
+#               of osstest.  Will use "sudo".
+#
+#  ./mg-hosts create-like SOURCE-HOST NEW-HOST[,NEW-HOST...]
+#               Create new host(s).  This does NOT copy the
+#               flags and properties (!)
+#
+#  ./mg-hosts manual-task-create USER@NODENAME
+#  ./mg-hosts manual-task-create REFKEY
+#               Creates a static manual (ie, permanent) task with
+#               the specified REFKEY.  The usual format of REFKEY
+#               is USER@NODENAME.
+#
+#  ./mg-hosts previoustasks [--clear]
+#               Lists all ownd (ie, transient) tasks which are from
+#               previous instances of ms-ownerdaemon (normally, this
+#               means tasks from previous boots of the osstest
+#               controller).  Also lists those tasks' resources.
+#
+#               With --clear, marks the tasks as dead, which will
+#               allow their resources to be reclaimed.  NB that this
+#               is dangerous if there might still be tasks running
+#               which started before the current ms-ownerdaemon: the
+#               old tasks might still mess about with the resources,
+#               interfering with whatever new tasks allocate them.
+#
+#  ./mg-hosts showprops [HOST...]
+#               Prints the resource properties of all or specified hosts.
+#
+#  ./mg-hosts setprops HOSTGLOB... [- PROP [OLD] NEW ...] -|-- PROP [OLD] NEW
+#               Updates resource properties of the specified hosts.
+#               If OLD is specified, the property will be set to NEW
+#               iff its value is currently OLD.  (The use of -- rather
+#               than - as the delimiter allows the last OLD or NEW
+#               to start with - without ambiguity in the command line.)
+#
+#  HOSTGLOB is a host name, or a glob pattern which may contain *.
+#  (? and [] are not supported in HOSTGLOB.)
+#
+#  ./mg-hosts showflags
+#               Print a table showing the flags of all hosts.
+#
+#  ./mg-hosts setflags HOSTGLOB... -|-- !FLAG|-FLAG|FLAG...
+#               Updates some flags of the specified hosts.  !FLAG and
+#               -FLAG both clear the flag; FLAG sets it.
+#
+#  ./mg-hosts setflagexpr HOSTGLOB... - FLAG EXPR [-|-- FLAG EXPR...]
+#               Sets or clears some flags of the specified hosts,
+#               according to a boolean expression involving other
+#               flags.  Each EXPR is evaluated for each host and
+#               the flag set or cleared accordingly.
+#
+#               In EXPR, the following constructs are allowed (in
+#               decreasing order of precedence):
+#                   (EXPR)       override precedence
+#                   !EXPR        boolean negation } alternative
+#                   ~EXPR        boolean negation }  equivalent syntax
+#                   EXPR|EXPR    boolean disjunction
+#                   EXPR&EXPR    boolean disjunction
+#                   FLAG         true iff FLAG is set for the host
+#               Spaces and tabs are disregarded (outside FLAG names).
+
 use strict qw(vars refs);
 use DBI;
 use Osstest;
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [OSSTEST PATCH 2/2] mg-hosts: Usage documentation.

Quoted 21 lines · Ian Jackson
---
 mg-hosts |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
mg-hosts +8 -0
index c116688..0e889f5 100755
@@ -17,6 +17,71 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
+# Usages:
+#
+#  ./mg-hosts mkpxedir HOST...
+#               Create directories for pxeboot as expected by the rest
+#               of osstest.  Will use "sudo".
+#
+#  ./mg-hosts create-like SOURCE-HOST NEW-HOST[,NEW-HOST...]
+#               Create new host(s).  This does NOT copy the

mg-hosts line 37

Quoted 10 lines
mg-hosts +10 -0
+#               flags and properties (!)
+#
+#  ./mg-hosts manual-task-create USER@NODENAME
+#  ./mg-hosts manual-task-create REFKEY
+#               Creates a static manual (ie, permanent) task with
+#               the specified REFKEY.  The usual format of REFKEY
+#               is USER@NODENAME.
+#
+#  ./mg-hosts previoustasks [--clear]
+#               Lists all ownd (ie, transient) tasks which are from

"owned" or did you mean pwnd? ;-)

Quoted 10 lines
mg-hosts +10 -0
+#               previous instances of ms-ownerdaemon (normally, this
+#               means tasks from previous boots of the osstest
+#               controller).  Also lists those tasks' resources.
+#
+#               With --clear, marks the tasks as dead, which will
+#               allow their resources to be reclaimed.  NB that this
+#               is dangerous if there might still be tasks running
+#               which started before the current ms-ownerdaemon: the
+#               old tasks might still mess about with the resources,
+#               interfering with whatever new tasks allocate them.

mg-hosts line 57

Quoted 10 lines
mg-hosts +10 -0
+#
+#  ./mg-hosts showprops [HOST...]
+#               Prints the resource properties of all or specified hosts.
+#
+#  ./mg-hosts setprops HOSTGLOB... [- PROP [OLD] NEW ...] -|-- PROP [OLD] NEW
+#               Updates resource properties of the specified hosts.
+#               If OLD is specified, the property will be set to NEW
+#               iff its value is currently OLD.  (The use of -- rather
+#               than - as the delimiter allows the last OLD or NEW
+#               to start with - without ambiguity in the command line.)

This one always took me ages to figure out, thanks ;-)

Quoted 14 lines
mg-hosts +14 -0
+#
+#  HOSTGLOB is a host name, or a glob pattern which may contain *.
+#  (? and [] are not supported in HOSTGLOB.)
+#
+#  ./mg-hosts showflags
+#               Print a table showing the flags of all hosts.
+#
+#  ./mg-hosts setflags HOSTGLOB... -|-- !FLAG|-FLAG|FLAG...
+#               Updates some flags of the specified hosts.  !FLAG and
+#               -FLAG both clear the flag; FLAG sets it.
+#
+#  ./mg-hosts setflagexpr HOSTGLOB... - FLAG EXPR [-|-- FLAG EXPR...]
+#               Sets or clears some flags of the specified hosts,
+#               according to a boolean expression involving other

mg-hosts line 81

Quoted 10 lines
mg-hosts +10 -0
+#               flags.  Each EXPR is evaluated for each host and
+#               the flag set or cleared accordingly.
+#
+#               In EXPR, the following constructs are allowed (in
+#               decreasing order of precedence):
+#                   (EXPR)       override precedence
+#                   !EXPR        boolean negation } alternative
+#                   ~EXPR        boolean negation }  equivalent syntax
+#                   EXPR|EXPR    boolean disjunction
+#                   EXPR&EXPR    boolean disjunction

One of those disjunction should be conjunction or something.

Quoted 6 lines
mg-hosts +3 -0
+#                   FLAG         true iff FLAG is set for the host
+#               Spaces and tabs are disregarded (outside FLAG names).
+
 use strict qw(vars refs);
 use DBI;
 use Osstest;
#3 lore raw

Re: [OSSTEST PATCH 2/2] mg-hosts: Usage documentation.

Ian Campbell writes ("Re: [OSSTEST PATCH 2/2] mg-hosts: Usage documentation."):

Quoted 5 lines · Ian Jackson

mg-hosts line 37

Quoted 2 lines
mg-hosts +2 -0
+#  ./mg-hosts previoustasks [--clear]
+#               Lists all ownd (ie, transient) tasks which are from

"owned" or did you mean pwnd? ;-)

No, they have a field in the database with value "ownd", short for "owner daemon".

Quoted 7 lines
Quoted 7 lines
mg-hosts +7 -0
+#  ./mg-hosts setflagexpr HOSTGLOB... - FLAG EXPR [-|-- FLAG EXPR...]
+#               Sets or clears some flags of the specified hosts,
+#               according to a boolean expression involving other
+#               flags.  Each EXPR is evaluated for each host and
+#               the flag set or cleared accordingly.
+#
+#               In EXPR, the following constructs are allowed (in
Quoted 8 lines

mg-hosts line 81

Quoted 6 lines
mg-hosts +6 -0
+#               decreasing order of precedence):
+#                   (EXPR)       override precedence
+#                   !EXPR        boolean negation } alternative
+#                   ~EXPR        boolean negation }  equivalent syntax
+#                   EXPR|EXPR    boolean disjunction
+#                   EXPR&EXPR    boolean disjunction

One of those disjunction should be conjunction or something.

Oh yes. Will fix.

Thanks,
Ian.

#4 lore raw

Re: [OSSTEST PATCH 2/2] mg-hosts: Usage documentation.

Quoted 9 lines · Ian Jackson

Ian Campbell writes ("Re: [OSSTEST PATCH 2/2] mg-hosts: Usage documentation."):

Quoted 5 lines · Ian Jackson

mg-hosts line 37

Quoted 2 lines
mg-hosts +2 -0
+#  ./mg-hosts previoustasks [--clear]
+#               Lists all ownd (ie, transient) tasks which are from

"owned" or did you mean pwnd? ;-)

No, they have a field in the database with value "ownd", short for "owner daemon".

Aha, ok then.

Quoted 21 lines
Quoted 16 lines
Quoted 4 lines
mg-hosts +3 -0
+#  ./mg-hosts setflagexpr HOSTGLOB... - FLAG EXPR [-|-- FLAG EXPR...]
+#               Sets or clears some flags of the specified hosts,
+#               according to a boolean expression involving other

mg-hosts line 81

Quoted 10 lines
mg-hosts +10 -0
+#               flags.  Each EXPR is evaluated for each host and
+#               the flag set or cleared accordingly.
+#
+#               In EXPR, the following constructs are allowed (in
+#               decreasing order of precedence):
+#                   (EXPR)       override precedence
+#                   !EXPR        boolean negation } alternative
+#                   ~EXPR        boolean negation }  equivalent syntax
+#                   EXPR|EXPR    boolean disjunction
+#                   EXPR&EXPR    boolean disjunction

One of those disjunction should be conjunction or something.

Oh yes. Will fix.

Thanks,
Ian.