Commit 24b8c3d4 authored by Mike Hibler's avatar Mike Hibler

Add '-l' option to list the current settings of the various boot osid fields.

parent e686364c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group. # Copyright (c) 2000-2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -18,12 +18,13 @@ Usage: os_select [-h] [-d] [-c] [-1 | -t] [<osid>] <node> [<node> ...] ...@@ -18,12 +18,13 @@ Usage: os_select [-h] [-d] [-c] [-1 | -t] [<osid>] <node> [<node> ...]
-1 Apply change to one-time boot field -1 Apply change to one-time boot field
-t Apply change to temporary boot field -t Apply change to temporary boot field
-b Reset to default boot osid. Do not provide an osid. -b Reset to default boot osid. Do not provide an osid.
-l Show the current settings.
osid OS identifier for the selected OS (see web interface for listing) osid OS identifier for the selected OS (see web interface for listing)
node Node identifiers (ie pcXX) node Node identifiers (ie pcXX)
EOF EOF
exit(-1); exit(-1);
} }
my $optlist = "hdc1tb"; my $optlist = "hdc1tbl";
# un-taint path # un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin'; $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
...@@ -68,6 +69,7 @@ my $oneshot = 0; # apply change to next_boot_osid. ...@@ -68,6 +69,7 @@ my $oneshot = 0; # apply change to next_boot_osid.
my $tempmode = 0; # apply change to temp_boot_osid. my $tempmode = 0; # apply change to temp_boot_osid.
my $clear = 0; # Clear the selected boot (def,temp,next). my $clear = 0; # Clear the selected boot (def,temp,next).
my $default = 0; # Reset back to default osid. my $default = 0; # Reset back to default osid.
my $list = 0; # Just list the current settings.
my @nodes = (); my @nodes = ();
my $osid; my $osid;
my $osinfo; my $osinfo;
...@@ -87,9 +89,10 @@ if (defined($options{"1"})) { $oneshot=1; } ...@@ -87,9 +89,10 @@ if (defined($options{"1"})) { $oneshot=1; }
if (defined($options{"t"})) { $tempmode=1; } if (defined($options{"t"})) { $tempmode=1; }
if (defined($options{"c"})) { $clear=1; } if (defined($options{"c"})) { $clear=1; }
if (defined($options{"b"})) { $default=1; } if (defined($options{"b"})) { $default=1; }
if (defined($options{"l"})) { $list=1; }
# In clearmode, there is no OSID. Just a list of nodes. # In clearmode, there is no OSID. Just a list of nodes.
if (! ($clear || $default)) { if (! ($clear || $list || $default)) {
usage() usage()
if (@ARGV < 2); if (@ARGV < 2);
$osid = shift(); $osid = shift();
...@@ -131,7 +134,7 @@ if ($UID && !TBAdmin($UID) && ...@@ -131,7 +134,7 @@ if ($UID && !TBAdmin($UID) &&
# #
# Grab the info for the OSID. # Grab the info for the OSID.
# #
if (! ($clear || $default)) { if (! ($clear || $list || $default)) {
$osinfo = OSinfo->Lookup($osid); $osinfo = OSinfo->Lookup($osid);
fatal("Improper DB entry for OSID: $osid") fatal("Improper DB entry for OSID: $osid")
if (!defined($osinfo)); if (!defined($osinfo));
...@@ -143,6 +146,30 @@ elsif ($default) { ...@@ -143,6 +146,30 @@ elsif ($default) {
foreach my $node (@nodes) { foreach my $node (@nodes) {
my $nodeobject = Node->Lookup($node); my $nodeobject = Node->Lookup($node);
# In list mode, show all the IDs
if ($list) {
my $tb = $nodeobject->temp_boot_osid();
my $nb = $nodeobject->next_boot_osid();
my $db = $nodeobject->def_boot_osid();
print "$node: ";
if ($tb) {
$info = OSinfo->Lookup($tb);
print "temp=$info";
print ", ";
}
if ($nb) {
$info = OSinfo->Lookup($nb);
print "next=$info";
print ", ";
}
if ($db) {
$info = OSinfo->Lookup($db);
print "default=$info";
}
print "\n";
next;
}
# The field to change in the DB. # The field to change in the DB.
my $field = "def_boot_osid"; my $field = "def_boot_osid";
$field = "next_boot_osid" $field = "next_boot_osid"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment