]> pere.pagekite.me Git - homepage.git/commitdiff
Minor update.
authorPetter Reinholdtsen <pere@hungry.com>
Fri, 6 Mar 2009 15:09:59 +0000 (15:09 +0000)
committerPetter Reinholdtsen <pere@hungry.com>
Fri, 6 Mar 2009 15:09:59 +0000 (15:09 +0000)
blog/data/2009-02-28-hw-support.txt

index 10ed3a4fd2ba6133be73d7f70a20f52e050ae062..5ed207e0fd8daad2e370c8077c026f861fee9775 100644 (file)
@@ -58,13 +58,25 @@ sub get_support_info {
         foreach my $line (@lines) {
             next unless ($line =~ m/Beskrivelse/);
             $line =~ s/&lt;[^>]+?>/;/gm;
-            $line =~ m%;(\d{2})/(\d{2})/(\d{4});+(\d{2})/(\d{2})/(\d{4});%g;
-            my $start = "$3-$1-$2";
-            my $end = "$6-$4-$5";
-            $str = "$start -> $end";
+            $line =~ s/^.+?;(Beskrivelse;)/$1/;
+
+            my @f = split(/\;/, $line);
+            @f = @f[13 .. $#f];
+            my $lastend = "";
+            while ($f[3] eq "DELL") {
+                my ($type, $startstr, $endstr, $days) = @f[0, 5, 7, 10];
+
+                my $start = POSIX::strftime("%Y-%m-%d",
+                                            localtime(str2time($startstr)));
+                my $end = POSIX::strftime("%Y-%m-%d",
+                                          localtime(str2time($endstr)));
+                $str .= "$type $start -> $end ";
+                @f = @f[14 .. $#f];
+                $lastend = $end if ($end gt $lastend);
+            }
             my $today = POSIX::strftime("%Y-%m-%d", localtime(time));
             tag_machine_unsupported($machine)
-                if ($end lt $today);
+                if ($lastend lt $today);
         }
     } elsif ( $model =~ m/^HP / ) {
         my $mech = WWW::Mechanize->new();
@@ -105,6 +117,7 @@ sub get_support_info {
                 if ($end lt $today);
         }
     } elsif ( $model =~ m/^IBM / ) {
+        # This code ignore extended support contracts.
         my ($producttype) = $model =~ m/.*-\[(.{4}).+\]-/;
         if ($producttype &amp;&amp; $serial) {
             my $content =
@@ -143,4 +156,9 @@ print get_support_info("ibm.host", "IBM eserver xSeries 345 -[867061X]-",
 </pre>
 
 <p>I would recommend this approach for tracking support contracts for
-everyone with more than a new computers to administer. :)</p>
+everyone with more than a few computers to administer. :)</p>
+
+<p>Update 2009-03-06: The IBM page do not include extended support
+contracts, so it is useless in that case.  The original Dell code do
+not handle extended support contracts either, but has been updated to
+do so.</p>