Skip to contentSkip to conversation

ms-* html generation: Provide <title>s

PATCH In review Ian Jackson 2 participants 6 messages Jan 4, 2016 – Jan 5, 2016

lore
Share & tools
lore
#0 lore raw

cover ms-* html generation: Provide <title>s

These two patches provide proper HTML titles for the planner output.

I have tested them by running them in the Citrix Cambridge instance, where they are currently live.

#1 lore raw

PATCH 1/2 ms-* html generation: Provide <title>

This means that these browser windows will actually get titles!

---
 ms-flights-summary |    2 ++
 ms-planner         |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
ms-flights-summary +2 -0
index ec8fa18..ea72088 100755
@@ -347,6 +347,8 @@ foreach my $f (keys %flights) {
 
 gather_events();
 
+printf("<html><head><title>Flights - %s</title></head><body>\n",
+       $c{DnsDomain} // '?');
 printf("<p>Report at ".fmttime(time)." based on plan at ".fmttime($plan->{Start})."</p>\n");
 
 printf("<p><h1>Overview</h1></p>\n");
ms-planner +4 -1
index fc65a5b..7ce0405 100755
@@ -687,6 +687,9 @@ sub cmd_show_html () {
     #print DEBUG "==============================\n",
     #    Dumper(\@rows, \@newoutcols);
 
+    printf "<html><head><title>Resource %s - %s</title></head><body>\n",
+        $walker, ($c{DnsDomain} // '?');
+
     printf "<table rules=all><tr><td>plan age %s</td><td>report at %s</td>\n",
         show_rel_time($now);
     foreach my $ch (@colheads) {
@@ -753,7 +756,7 @@ sub cmd_show_html () {
 	    printf "</ul>\n";
 	    printf "<p>\n";
     }
-    printf "Report generated %s.\n",
+    printf "Report generated %s.\n</body></html>",
         strftime("%Y-%b-%d %a %H:%M:%S", localtime $now);
     die $! if STDOUT->error;
     die $! unless STDOUT->flush;
Signature · 1 line
1.7.10.4
Acked-by on v1 1/2
#2 lore raw

Re: [OSSTEST PATCH 1/2] ms-* html generation: Provide <title>

Quoted 1 line · Ian Jackson

This means that these browser windows will actually get titles!

!

I suppose in theory we ought to also close the <body> tag, but we've not even been opening it until now, so blah.

Quoted 1 line
#3 lore raw

PATCH 2/2 ms-* html generation: Provide right title for projection

In reply to Ian Jackson

When ms-queuedaemon generates a resource-projection.html, it sometimes does so from data-plan.pl (see proc report-plan). This means that ms-planner does not get a reliable indication of whether it is being run for the plan or the projection, and the resource-project.html sometimes claims to be the plan.

Fix with a new ms-planner option -W which tells it what to put in the title, defaulting to the value passed to -w.

DEPLOYMENT NOTE:

The new ms-planner works with the old queuedaemon, so when upgrading, it is OK to simply update the daemons-testing.git and then restart the ms-queuedaemon.

If it is necessary to downgrade, rewinding to the old commit with a running ms-queuedaemon will cause errors from the old ms-planner being passed -w -- but these errors are trapped and ignored. So in this case reports will be out of datte until ms-queuedaemon is also restarted.

In either case nothing will go badly wrong.

---
 ms-planner     |    7 ++++++-
 ms-queuedaemon |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)
ms-planner +6 -1
index 7ce0405..6f4a511 100755
@@ -34,6 +34,7 @@ use Osstest::Executive;
 open DEBUG, ">/dev/null" or die $!;
 
 our $walker = 'plan';
+our $walker_show;
 
 while (@ARGV and $ARGV[0] =~ m/^-/) {
     $_= shift @ARGV;
@@ -43,12 +44,16 @@ while (@ARGV and $ARGV[0] =~ m/^-/) {
             open DEBUG, ">&STDERR" or die $!;
         } elsif (s/^-w(.+)/-/) {
 	    $walker = $1;
+        } elsif (s/^-W(.+)/-/) {
+	    $walker_show = $1;
         } else {
             die "$_ ?";
         }
     }
 }
 
+$walker_show //= $walker;
+
 csreadconfig();
 
 our ($plan);
@@ -688,7 +693,7 @@ sub cmd_show_html () {
     #    Dumper(\@rows, \@newoutcols);
 
     printf "<html><head><title>Resource %s - %s</title></head><body>\n",
-        $walker, ($c{DnsDomain} // '?');
+        $walker_show, ($c{DnsDomain} // '?');
 
     printf "<table rules=all><tr><td>plan age %s</td><td>report at %s</td>\n",
         show_rel_time($now);
ms-queuedaemon +1 -1
index 08f88cf..2b8d621 100755
@@ -301,7 +301,7 @@ proc report-plan {w wo} {
     global c
     catching-internally "showing $w html" {
 	set outputfile "$c(WebspaceFile)/resource-$wo.html"
-	exec ./ms-planner -w$w show-html > $outputfile
+	exec ./ms-planner -w$w -W$wo show-html > $outputfile
     } {
 	set out data-$wo.final.pl
 	file copy -force data-$w.pl $out.new
Signature · 1 line
1.7.10.4
Acked-by on v1 2/2
#4 lore raw

Re: [OSSTEST PATCH 2/2] ms-* html generation: Provide right title for projection

Quoted 11 lines · Ian Jackson

When ms-queuedaemon generates a resource-projection.html, it sometimes does so from data-plan.pl (see proc report-plan).  This means that ms-planner does not get a reliable indication of whether it is being run for the plan or the projection, and the resource-project.html sometimes claims to be the plan.

Fix with a new ms-planner option -W which tells it what to put in the title, defaulting to the value passed to -w.

DEPLOYMENT NOTE:

Quoted 8 lines

The new ms-planner works with the old queuedaemon, so when upgrading, it is OK to simply update the daemons-testing.git and then restart the ms-queuedaemon.

If it is necessary to downgrade, rewinding to the old commit with a running ms-queuedaemon will cause errors from the old ms-planner being passed -w -- but these errors are trapped and ignored.  So in this case reports will be out of datte until ms-queuedaemon is also

"date" (but I expect you will remove this on commit anyway?)

Quoted 5 lines

restarted.

In either case nothing will go badly wrong.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw

Re: [OSSTEST PATCH 2/2] ms-* html generation: Provide right title for projection

Ian Campbell writes ("Re: [OSSTEST PATCH 2/2] ms-* html generation: Provide right title for projection"):

Quoted 2 lines · Ian Jackson
Quoted 1 line

DEPLOYMENT NOTE:

...

Quoted 6 lines
Quoted 4 lines

If it is necessary to downgrade, rewinding to the old commit with a running ms-queuedaemon will cause errors from the old ms-planner being passed -w -- but these errors are trapped and ignored.  So in this case reports will be out of datte until ms-queuedaemon is also

"date" (but I expect you will remove this on commit anyway?)

Fixed. I think we should leave these in for the benefit of anyone else...

Ian.