From b754e3ecedaa5ec43fbce20a578c01127d5fc42d Mon Sep 17 00:00:00 2001 From: bp-sawyers Date: Sat, 5 Apr 2008 14:53:35 +0000 Subject: [PATCH] - fixed xdsh -K again by making Client.pm always require xCAT::NodeRange - removed many of the v options on the tar cmds to build are not as verbose - removed an extra fi in xcat.spec %post git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@984 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- makeclientrpm | 2 +- makeperlxcatrpm | 2 +- makermcrpm | 2 +- makeserverrpm | 2 +- makewebrpm | 2 +- perl-xCAT-2.0/xCAT/Client.pm | 30 ++--- perl-xCAT-2.0/xCAT/NodeRange.pm | 4 +- perl-xCAT-2.0/xCAT/NotifHandler.pm | 16 +-- perl-xCAT-2.0/xCAT/Schema.pm | 4 +- perl-xCAT-2.0/xCAT/Table.pm | 12 +- perl-xCAT-2.0/xCAT/Utils.pm | 190 ++++++++++++++--------------- xCAT-client-2.0/bin/xdsh | 38 +++--- xCAT/mkrpm | 16 +-- xCAT/xCAT.spec | 36 +++--- xCATsn/mkrpm | 6 +- 15 files changed, 173 insertions(+), 189 deletions(-) diff --git a/makeclientrpm b/makeclientrpm index b7a76cf16..928568fca 100755 --- a/makeclientrpm +++ b/makeclientrpm @@ -7,7 +7,7 @@ then echo '.svn' > /tmp/xcat-excludes tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-client-2.0.tar xCAT-client-2.0 - gzip /opt/freeware/src/packages/SOURCES/xCAT-client-2.0.tar + gzip -f /opt/freeware/src/packages/SOURCES/xCAT-client-2.0.tar cd ./xCAT-client-2.0 rm -f /opt/freeware/src/packages/SRPMS/xCAT-client-2.0*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-client-2.0*rpm rpm -ba xCAT-client.spec diff --git a/makeperlxcatrpm b/makeperlxcatrpm index e5993247c..ed856f8ef 100755 --- a/makeperlxcatrpm +++ b/makeperlxcatrpm @@ -7,7 +7,7 @@ then echo '.svn' > /tmp/xcat-excludes tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/perl-xCAT-2.0.tar perl-xCAT-2.0 - gzip /opt/freeware/src/packages/SOURCES/perl-xCAT-2.0.tar + gzip -f /opt/freeware/src/packages/SOURCES/perl-xCAT-2.0.tar cd ./perl-xCAT-2.0 rm -f /opt/freeware/src/packages/SRPMS/perl-xCAT-2.0*rpm /opt/freeware/src/packages/RPMS/ppc/perl-xCAT-2.0*rpm rpm -ba perl-xCAT.spec diff --git a/makermcrpm b/makermcrpm index a9a543dba..34ce1ef3b 100755 --- a/makermcrpm +++ b/makermcrpm @@ -10,7 +10,7 @@ then rm -f /opt/freeware/src/packages/SRPMS/xCAT-rmc*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-rmc*rpm echo '.svn' > /tmp/xcat-excludes tar -X /tmp/xcat-excludes -cf xCAT-rmc-$version.tar xCAT-rmc-$version - gzip /opt/freeware/src/packages/SOURCES/xCAT-rmc-$version.tar + gzip -f /opt/freeware/src/packages/SOURCES/xCAT-rmc-$version.tar cd $source/xCAT-rmc rpm -ba xCAT-rmc.spec #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-rmc*rpm diff --git a/makeserverrpm b/makeserverrpm index 7c5117230..bcb23aa2b 100755 --- a/makeserverrpm +++ b/makeserverrpm @@ -7,7 +7,7 @@ then echo '.svn' > /tmp/xcat-excludes tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-server-2.0.tar xCAT-server-2.0 - gzip /opt/freeware/src/packages/SOURCES/xCAT-server-2.0.tar + gzip -f /opt/freeware/src/packages/SOURCES/xCAT-server-2.0.tar cd ./xCAT-server-2.0 rm -f /opt/freeware/src/packages/SRPMS/xCAT-server-2.0*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-server-2.0*rpm rpm -ba xCAT-server.spec diff --git a/makewebrpm b/makewebrpm index fcec967f4..d8aa032c2 100644 --- a/makewebrpm +++ b/makewebrpm @@ -7,7 +7,7 @@ if [ "$OSNAME" = "AIX" ] then echo '.svn' > /tmp/xcat-excludes tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-web.tar xCAT-web - gzip /opt/freeware/src/packages/SOURCES/xCAT-web.tar + gzip -f /opt/freeware/src/packages/SOURCES/xCAT-web.tar cd ./xCAT-web rm -f /opt/freeware/src/packages/SRPMS/xCAT-web*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-web*rpm rpm -ba xCAT-web.spec diff --git a/perl-xCAT-2.0/xCAT/Client.pm b/perl-xCAT-2.0/xCAT/Client.pm index db241ed1e..2c276a0aa 100644 --- a/perl-xCAT-2.0/xCAT/Client.pm +++ b/perl-xCAT-2.0/xCAT/Client.pm @@ -4,17 +4,11 @@ package xCAT::Client; BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; - require lib; - lib->import("$::XCATROOT/lib/perl"); - if ($ENV{XCATBYPASS}) { - require xCAT::NodeRange; - xCAT::NodeRange->import; - require xCAT::Utils; - xCAT::Utils->import; - require xCAT::Table; - xCAT::Table->import; - } } +use lib "$::XCATROOT/lib/perl"; +require xCAT::NodeRange; +require xCAT::Utils; +require xCAT::Table; my $inet6support; use IO::Socket::SSL; @@ -32,7 +26,7 @@ unless ($inet6support) { use XML::Simple; $XML::Simple::PREFERRED_PARSER='XML::Parser'; -use Data::Dumper; +require Data::Dumper; use Storable qw(dclone); my $xcathost='localhost:3001'; my $plugins_dir; @@ -219,10 +213,10 @@ sub plugin_command { if ($req->{node}) { @nodes = @{$req->{node}}; } elsif ($req->{noderange}) { - @nodes = noderange($req->{noderange}->[0]); - if (nodesmissed) { -# my $rsp = {errorcode=>1,error=>"Invalid nodes in noderange:".join(',',nodesmissed)}; - print "Invalid nodes in noderange:".join(',',nodesmissed)."\n"; + @nodes = xCAT::NodeRange::noderange($req->{noderange}->[0]); + if (xCAT::NodeRange::nodesmissed()) { +# my $rsp = {errorcode=>1,error=>"Invalid nodes in noderange:".join(',',xCAT::NodeRange::nodesmissed)}; + print "Invalid nodes in noderangex:".join(',',xCAT::NodeRange::nodesmissed())."\n"; # if ($sock) { # print $sock XMLout($rsp,RootName=>'xcatresponse' ,NoAttr=>1); # } @@ -372,10 +366,10 @@ sub do_request { if ($cmd_handlers{$req->{command}->[0]}) { return plugin_command($req,$sock,$rsphandler); } elsif ($req->{command}->[0] eq "noderange" and $req->{noderange}) { - my @nodes = noderange($req->{noderange}->[0]); + my @nodes = xCAT::NodeRange::noderange($req->{noderange}->[0]); my %resp; - if (nodesmissed) { - $resp{warning}="Invalid nodes in noderange:".join ',',nodesmissed ."\n"; + if (xCAT::NodeRange::nodesmissed()) { + $resp{warning}="Invalid nodes in noderange:".join ',',xCAT::NodeRange::nodesmissed() ."\n"; } $resp{serverdone} = {}; @{$resp{node}}=@nodes; diff --git a/perl-xCAT-2.0/xCAT/NodeRange.pm b/perl-xCAT-2.0/xCAT/NodeRange.pm index 6b04561dc..4a650f0ff 100644 --- a/perl-xCAT-2.0/xCAT/NodeRange.pm +++ b/perl-xCAT-2.0/xCAT/NodeRange.pm @@ -1,7 +1,7 @@ # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT::NodeRange; -use xCAT::Table; -use Data::Dumper; +require xCAT::Table; +require Data::Dumper; require Exporter; use strict; diff --git a/perl-xCAT-2.0/xCAT/NotifHandler.pm b/perl-xCAT-2.0/xCAT/NotifHandler.pm index 86148565a..eed381999 100644 --- a/perl-xCAT-2.0/xCAT/NotifHandler.pm +++ b/perl-xCAT-2.0/xCAT/NotifHandler.pm @@ -8,8 +8,8 @@ BEGIN use lib "$::XCATROOT/lib/perl"; use File::Basename qw(fileparse); -use xCAT::Utils; -use Data::Dumper; +require xCAT::Utils; +require Data::Dumper; #%notif is a cache that holds the info from the "notification" table. #the format of it is: @@ -33,13 +33,13 @@ $masterpid; #-------------------------------------------------------------------------------- -=head3 setup +=head3 setup It is called by xcatd to get set the pid of the parent of all this object. Setup the signal to trap any changes in the notification table. It also initializes the cache with the current data in the notification table. table and store it into %notif variable. Arguments: - pid -- the process id of the caller. + pid -- the process id of the caller. Returns: none =cut @@ -51,7 +51,7 @@ sub setup $masterpid=shift; } refreshNotification(); - + $SIG{USR1}=\&handleNotifSignal; } @@ -298,7 +298,7 @@ sub notify { my ($modname, $path, $suffix) = fileparse($_, ".pm"); # print "modname=$modname, path=$path, suffix=$suffix\n"; if ($suffix =~ /.pm/) { #it is a perl module - my $pid; + my $pid; if ($pid=xCAT::Utils->xfork()) { } elsif (defined($pid)) { my $fname; @@ -309,8 +309,8 @@ sub notify { $fname = $_; } eval {require($fname)}; - if ($@) { - print "The file $fname cannot be located or has compiling errors.\n"; + if ($@) { + print "The file $fname cannot be located or has compiling errors.\n"; } else { ${"xCAT_monitoring::".$modname."::"}{processTableChanges}->($action, $tablename, $old_data, $new_data); diff --git a/perl-xCAT-2.0/xCAT/Schema.pm b/perl-xCAT-2.0/xCAT/Schema.pm index d4f528775..064dfa8b8 100644 --- a/perl-xCAT-2.0/xCAT/Schema.pm +++ b/perl-xCAT-2.0/xCAT/Schema.pm @@ -288,9 +288,9 @@ osimage => { passwd => { cols => [qw(key username password comments disable)], keys => [qw(key)], - table_desc => 'Contains default userids and passwords for xCAT to access cluster components. Userids/passwords for specific cluster components can be overidden in other tables, e.g. mpa, ipmi, ppchcp, etc.', + table_desc => 'Contains default userids and passwords for xCAT to access cluster components. In most cases, xCAT will also actually set the userid/password in the relevant component when it is being configured or installed. Userids/passwords for specific cluster components can be overidden in other tables, e.g. mpa, ipmi, ppchcp, etc.', descriptions => { - key => 'The type of component this user/pw is for. Valid values: blade (management module), ipmi (BMC), system (nodes??), omapi (DHCP), hmc, ivm, fsp.', + key => 'The type of component this user/pw is for. Valid values: blade (management module), ipmi (BMC), system (nodes), omapi (DHCP), hmc, ivm, fsp.', username => 'The default userid for this type of component', password => 'The default password for this type of component', comments => 'Any user-written notes.', diff --git a/perl-xCAT-2.0/xCAT/Table.pm b/perl-xCAT-2.0/xCAT/Table.pm index e207238a7..bd971e526 100644 --- a/perl-xCAT-2.0/xCAT/Table.pm +++ b/perl-xCAT-2.0/xCAT/Table.pm @@ -17,12 +17,12 @@ use lib "$::XCATROOT/lib/perl"; use DBI; #use strict; -use Data::Dumper; +require Data::Dumper; use Scalar::Util qw/weaken/; -use xCAT::Schema; -use xCAT::NodeRange; +require xCAT::Schema; +require xCAT::NodeRange; use Text::Balanced qw(extract_bracketed); -use xCAT::NotifHandler; +require xCAT::NotifHandler; #-------------------------------------------------------------------------------- @@ -963,7 +963,7 @@ sub getNodeAttribs $answval =~ s/$parts[0]/$retval/; $datum->{$attrib} = $answval; #$retval; - #print Dumper(extract_bracketed($parts[1],'()',qr/[^()]*/)); + #print Data::Dumper::Dumper(extract_bracketed($parts[1],'()',qr/[^()]*/)); #use text::balanced extract_bracketed to parse earch atom, make sure nothing but arith operators, parans, and numbers are in it to guard against code execution } } @@ -1244,7 +1244,7 @@ sub getAllNodeAttribs unless ($data->{node} =~ /^$/ || !defined($data->{node})) { #ignore records without node attrib, not possible? my @nodes = - noderange($data->{node}) + xCAT::NodeRange::noderange($data->{node}) ; #expand node entry, to make groups expand foreach (@nodes) { diff --git a/perl-xCAT-2.0/xCAT/Utils.pm b/perl-xCAT-2.0/xCAT/Utils.pm index f5938bee9..a3fe0c178 100644 --- a/perl-xCAT-2.0/xCAT/Utils.pm +++ b/perl-xCAT-2.0/xCAT/Utils.pm @@ -1,13 +1,13 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT::Utils; -use xCAT::Table; +require xCAT::Table; use POSIX qw(ceil); use Socket; -use xCAT::Schema; -use Data::Dumper; -use xCAT::NodeRange; -use DBI; +require xCAT::Schema; +require Data::Dumper; +require xCAT::NodeRange; +require DBI; #-------------------------------------------------------------------------------- @@ -168,7 +168,7 @@ sub isLinux =head3 make_node_list_file - Makes a node list file. + Makes a node list file. Arguments: (\@list_of_nodes) - reference to an arrary of nodes. @@ -179,7 +179,7 @@ sub isLinux Error: None documented Example: - xCAT::Utils->make_node_list_file(\@nodelist); + xCAT::Utils->make_node_list_file(\@nodelist); Comments: IMPORTANT: @@ -245,13 +245,13 @@ for ($nI = 0 ; $nI < 8 ; $nI++) #----------------------------------------------------------------------- -=head3 +=head3 close_delete_file. Arguments: file handle,filename Returns: - none + none Globals: none Error: @@ -274,13 +274,13 @@ sub close_delete_file #----------------------------------------------------------------------- -=head3 +=head3 list_all_nodes Arguments: - + Returns: - an array of all define nodes from the nodelist table + an array of all define nodes from the nodelist table Globals: none Error: @@ -316,13 +316,13 @@ sub list_all_nodes #----------------------------------------------------------------------- -=head3 +=head3 list_all_nodegroups Arguments: - + Returns: - an array of all define node groups from the nodelist table + an array of all define node groups from the nodelist table Globals: none Error: @@ -369,13 +369,13 @@ sub list_all_node_groups #----------------------------------------------------------------------- -=head3 +=head3 list_nodes_in_nodegroup Arguments: nodegroup - + Returns: - an array of all define nodes in the node group + an array of all define nodes in the node group Globals: none @@ -393,19 +393,19 @@ sub list_nodes_in_nodegroups { my ($class, $group) = @_; $req->{noderange}->[0] = $group; - my @nodes = noderange($req->{noderange}->[0]); + my @nodes = xCAT::NodeRange::noderange($req->{noderange}->[0]); return @nodes; } #----------------------------------------------------------------------- -=head3 - get_site_attribute +=head3 + get_site_attribute Arguments: - + Returns: - The value of the attribute requested from the site table + The value of the attribute requested from the site table Globals: none Error: @@ -443,11 +443,11 @@ sub get_site_attribute #----------------------------------------------------------------------- -=head3 +=head3 add_cron_job This function adds a new cron job. Arguments: - job--- string in the crontab job format. + job--- string in the crontab job format. Returns: (code, message) Globals: @@ -501,12 +501,12 @@ sub add_cron_job #----------------------------------------------------------------------- -=head3 +=head3 remove_cron_job This function removes a new cron job. Arguments: - job--- a substring that is contained in a crontab entry. - (use crontab -l to see all the job entries.) + job--- a substring that is contained in a crontab entry. + (use crontab -l to see all the job entries.) Returns: (code, message) Globals: @@ -562,7 +562,7 @@ sub remove_cron_job =head3 runcmd Run the given cmd and return the output in an array (already chopped). - Alternately, if this function is used in a scalar context, the output + Alternately, if this function is used in a scalar context, the output is joined into a single string with the newlines separating the lines. Arguments: @@ -570,7 +570,7 @@ sub remove_cron_job Returns: see below Globals: - $::RUNCMD_RC , $::CALLBACK + $::RUNCMD_RC , $::CALLBACK Error: Normally, if there is an error running the cmd,it will display the error and exit with the cmds exit code, unless exitcode @@ -713,18 +713,18 @@ sub getHomeDir #-------------------------------------------------------------------------------- -=head3 setupSSH +=head3 setupSSH Transfers the ssh keys to setup ssh to the input nodes. Arguments: - Array of nodes + Array of nodes Returns: - + Globals: - $::XCATROOT , $::CALLBACK + $::XCATROOT , $::CALLBACK Error: - 0=good, 1=error + 0=good, 1=error Example: xCAT::Utils->setupSSH(@target_nodes); Comments: @@ -765,7 +765,7 @@ sub setupSSH if ($::RUNCMD_RC != 0) { # error my %rsp; - $rsp->{data}->[0] = "remoteshell.expect failed generating keys.\n"; + $rsp->{data}->[0] = "remoteshell.expect failed generating keys."; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); } @@ -793,7 +793,7 @@ umask(0077); if (! -d \"\$dest_dir\" ) { # create a local directory \$cmd = \"mkdir -p \$dest_dir\"; - system(\"\$cmd\"); + system(\"\$cmd\"); chmod 0700, \$dest_dir; } `cat /tmp/.ssh/authorized_keys >> \$home/.ssh/authorized_keys 2>&1`; @@ -821,7 +821,7 @@ rmdir(\"/tmp/.ssh\");"; if ($rc) { my %rsp; - $rsp->{data}->[0] = "remoteshell.expect failed sending keys.\n"; + $rsp->{data}->[0] = "remoteshell.expect failed sending keys."; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); } @@ -847,14 +847,14 @@ rmdir(\"/tmp/.ssh\");"; my $nstring = join ',', @badnodes; my %rsp; $rsp->{data}->[0] = - "SSH setup failed for the following nodes: $nstring.\n"; + "SSH setup failed for the following nodes: $nstring."; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); return @badnodes; } else { my %rsp; - $rsp->{data}->[0] = "$::REMOTE_SHELL setup is complete.\n"; + $rsp->{data}->[0] = "$::REMOTE_SHELL setup is complete."; xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); return 0; } @@ -868,11 +868,11 @@ rmdir(\"/tmp/.ssh\");"; /install/postscripts/.ssh. Arguments: - directory path + directory path Returns: - + Globals: - $::CALLBACK + $::CALLBACK Error: Example: @@ -975,20 +975,20 @@ sub cpSSHFiles #------------------------------------------------------------------------------- =head3 isServiceNode - checks for the /etc/xCATSN file - + checks for the /etc/xCATSN file + Arguments: none Returns: - 1 - localHost is ServiceNode - 0 - localHost is not ServiceNode + 1 - localHost is ServiceNode + 0 - localHost is not ServiceNode Globals: none Error: none Example: %::XCATMasterPort defined in the caller. - $return=(xCAT::Utils->isServiceNode()) + $return=(xCAT::Utils->isServiceNode()) Comments: none =cut @@ -1011,18 +1011,18 @@ sub isServiceNode =head3 isMN checks for the /etc/xCATMN file , if it exists it is a Management Server - + Arguments: none Returns: - 1 - localHost is ServiceNode - 0 - localHost is not ServiceNode + 1 - localHost is ServiceNode + 0 - localHost is not ServiceNode Globals: none Error: none Example: - $return=(xCAT::Utils->isMN()) + $return=(xCAT::Utils->isMN()) Comments: none =cut @@ -1044,7 +1044,7 @@ sub isMN #------------------------------------------------------------------------------- =head3 classful_networks_for_net_and_mask - + Arguments: network and mask Returns: @@ -1106,8 +1106,8 @@ sub classful_networks_for_net_and_mask #------------------------------------------------------------------------------- -=head3 my_hexnets - +=head3 my_hexnets + Arguments: none Returns: @@ -1196,8 +1196,8 @@ sub my_if_netmap #------------------------------------------------------------------------------- -=head3 my_ip_facing - +=head3 my_ip_facing + Arguments: none Returns: @@ -1240,9 +1240,9 @@ sub my_ip_facing #------------------------------------------------------------------------------- -=head3 nodeonmynet - checks to see if node is on the network +=head3 nodeonmynet - checks to see if node is on the network Arguments: - Node name + Node name Returns: 1 if node is on the network Globals: none @@ -1293,10 +1293,10 @@ sub nodeonmynet #------------------------------------------------------------------------------- -=head3 thishostisnot +=head3 thishostisnot returns 0 if host is not the same Arguments: - hostname + hostname Returns: Globals: none @@ -1339,18 +1339,18 @@ sub thishostisnot #------------------------------------------------------------------------------- -=head3 GetMasterNodeName +=head3 GetMasterNodeName Reads the database for the Master node name for the input node Arguments: Node Returns: - MasterHostName + MasterHostName Globals: none Error: none Example: - $master=(xCAT::Utils->GetMasterNodeName($node)) + $master=(xCAT::Utils->GetMasterNodeName($node)) Comments: none =cut @@ -1390,7 +1390,7 @@ sub GetMasterNodeName #------------------------------------------------------------------------------- -=head3 GetNodeOSARCH +=head3 GetNodeOSARCH Reads the database for the OS and Arch of the input Node Arguments: Node @@ -1402,7 +1402,7 @@ sub GetMasterNodeName Error: none Example: - $master=(xCAT::Utils->GetNodeOSARCH($node)) + $master=(xCAT::Utils->GetNodeOSARCH($node)) Comments: none =cut @@ -1433,8 +1433,8 @@ sub GetNodeOSARCH #----------------------------------------------------------------------------- -=head3 exportDBConfig - +=head3 exportDBConfig + Reads the /etc/sysconfig/xcat file for the DB configuration and exports it in $XCATCFG =cut @@ -1478,8 +1478,8 @@ sub exportDBConfig #----------------------------------------------------------------------------- -=head3 readSNInfo - +=head3 readSNInfo + Read resource, NFS server, Master node, OS an ARCH from the database for the service node @@ -1526,7 +1526,7 @@ sub readSNInfo #----------------------------------------------------------------------------- -=head3 isServiceReq +=head3 isServiceReq Checks to see if the input service is already setup on the node by @@ -1535,16 +1535,16 @@ sub readSNInfo It then: Checks the database to see if the input Service should be setup on the input service node - Checks the noderes to see if this service node is a service node for any + Checks the noderes to see if this service node is a service node for any node in the table. Any node that matches, it checks the service attribute to see if this service node is the server, or if the attribute is blank, then this service node is the server. - + Input: service nodename, service,ipaddres(s) of service node - Output: - 0 - no service required - 1 - setup service - 2 - service is setup, just start the daemon + Output: + 0 - no service required + 1 - setup service + 2 - service is setup, just start the daemon -1 - error Globals: none @@ -1672,11 +1672,11 @@ sub isServiceReq #----------------------------------------------------------------------------- =head3 determinehostname and ip address(s) - + Used on the service node to figure out what hostname and ip address(s) the service node is in the database - Input: None - Output: ipaddress(s),nodename + Input: None + Output: ipaddress(s),nodename =cut #----------------------------------------------------------------------------- @@ -1706,7 +1706,7 @@ sub determinehostname =head3 update_xCATSN Will add the input service string to /etc/xCATSN to indicate that the service has been setup by the service node - Input: service (e.g. tftp, nfs,etc) + Input: service (e.g. tftp, nfs,etc) Output: 0 = added, 1= already there =cut @@ -1732,11 +1732,11 @@ sub update_xCATSN #----------------------------------------------------------------------------- -=head3 gethost_ips - Will use ifconfig to determine all possible ip addresses for the +=head3 gethost_ips + Will use ifconfig to determine all possible ip addresses for the host it is running on - input: + input: output: array of ipaddress(s) example: @ips=xCAT::gethost_ips(); @@ -1768,12 +1768,12 @@ sub gethost_ips #----------------------------------------------------------------------------- =head3 create_postscripts_tar - + This routine will tar and compress the /install/postscripts directory and place in /install/autoinst/xcat_postscripts.Z - input: none - output: + input: none + output: example: $rc=xCAT::create_postscripts_tar(); =cut @@ -1802,7 +1802,7 @@ sub create_postscripts_tar #----------------------------------------------------------------------------- -=head3 get_site_Master +=head3 get_site_Master Reads the site table for the Master attribute and returns it. input: none @@ -1832,13 +1832,13 @@ sub get_site_Master #----------------------------------------------------------------------------- -=head3 get_ServiceNode +=head3 get_ServiceNode Will get the Service node ( name or ipaddress) as known by the Management Server or NOde for the input nodename or ipadress of the node input: list of nodenames and/or node ipaddresses - service name + service name "MN" or "Node" determines if you want the Service node as known by the Management Node or by the node. @@ -1846,18 +1846,18 @@ sub get_site_Master nfsserver,conserver,monserver service "xcat" is used by command like xdsh that need to know the - service node that will process the command but are not tied to a + service node that will process the command but are not tied to a specific service like tftp Todo: Handle dhcpserver and nameserver from the networks table - output: A hash of arrays, the key is the service node pointing to - an array of nodes that are serviced by that service node + output: A hash of arrays, the key is the service node pointing to + an array of nodes that are serviced by that service node Globals: - $::ERROR_RC + $::ERROR_RC Error: - $::ERROR_RC=0 no error $::ERROR_RC=1 error + $::ERROR_RC=0 no error $::ERROR_RC=1 error example: $sn =xCAT::Utils->get_ServiceNode(@nodes,$service,"MN"); diff --git a/xCAT-client-2.0/bin/xdsh b/xCAT-client-2.0/bin/xdsh index ff37f8788..519e9d42d 100644 --- a/xCAT-client-2.0/bin/xdsh +++ b/xCAT-client-2.0/bin/xdsh @@ -1,4 +1,5 @@ -#!/usr/bin/env perl +#!/usr/bin/perl +# !/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html BEGIN { @@ -8,9 +9,9 @@ use lib "$::XCATROOT/lib/perl"; use File::Basename; #use Data::Dumper; use Getopt::Long; -use xCAT::MsgUtils; -use xCAT::DSHCLI; -use xCAT::Client; +require xCAT::MsgUtils; +require xCAT::DSHCLI; +require xCAT::Client; my $bname = basename($0); #----------------------------------------------------------------------------- @@ -42,25 +43,19 @@ This program is the client interface for xdsh/xdcp. my $cmdref; my $arg; -my @SaveARGV = @ARGV; $cmdref->{command}->[0] = $bname; # save my command name -my $arg = shift(@SaveARGV); -if ($arg =~ /^-/) # no noderange -{ - push @{$cmdref->{arg}}, $arg; - foreach (@SAVEARGV) - { - push(@{$cmdref->{arg}}, $_); - } - @ARGV = @{$cmdref->{arg}}; # save just the argument to parse -} -else -{ - $cmdref->{noderange}->[0] = $arg; # save noderange - @ARGV = @SaveARGV; # noderange removed for parsing +# Pull out the 1st non-hyphen arg as the noderange +for (my $i=0; $i{noderange}->[0] = splice(@ARGV, $i, 1); # removes and returns the noderange + last; + } } +# Put all the rest of the args in the structure +push (@{$cmdref->{arg}}, @ARGV); + # check for help, bypass, other client flags if ($bname eq "xdsh") { @@ -71,11 +66,6 @@ else &parse_args_xdcp; } -foreach (@SaveARGV) -{ - push(@{$cmdref->{arg}}, $_); -} - # add environment variables, if they have not already been assigned with # command line flags if (!($::NODE_RSH)) diff --git a/xCAT/mkrpm b/xCAT/mkrpm index 11c642338..711a09dee 100755 --- a/xCAT/mkrpm +++ b/xCAT/mkrpm @@ -8,11 +8,11 @@ then cd `dirname $0` echo '.svn' > /tmp/xcat-excludes - tar -X /tmp/xcat-excludes -cvf /opt/freeware/src/packages/SOURCES/postscripts.tar postscripts LICENSE.html - gzip /opt/freeware/src/packages/SOURCES/postscripts.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/postscripts.tar postscripts LICENSE.html + gzip -f /opt/freeware/src/packages/SOURCES/postscripts.tar - tar -X /tmp/xcat-excludes -cvf /opt/freeware/src/packages/SOURCES/templates.tar templates - gzip /opt/freeware/src/packages/SOURCES/templates.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/templates.tar templates + gzip -f /opt/freeware/src/packages/SOURCES/templates.tar cp xcat.conf /opt/freeware/src/packages/SOURCES @@ -34,14 +34,14 @@ else fi cd `dirname $0` - tar --exclude .svn -czvf /usr/src/$pkg/SOURCES/postscripts.tar.gz postscripts LICENSE.html - tar --exclude .svn -czvf /usr/src/$pkg/SOURCES/templates.tar.gz templates + tar --exclude .svn -czf /usr/src/$pkg/SOURCES/postscripts.tar.gz postscripts LICENSE.html + tar --exclude .svn -czf /usr/src/$pkg/SOURCES/templates.tar.gz templates cp xcat.conf /usr/src/$pkg/SOURCES rm -f /usr/src/$pkg/SRPMS/xCAT-2.0*rpm /usr/src/$pkg/RPMS/*/xCAT-2.0*rpm if [ ! -z "$1" ]; then rpmbuild -ba xCAT.spec --target $1 - else - rpmbuild -ba xCAT.spec + else + rpmbuild -ba xCAT.spec fi cd - fi diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 3c126ea71..d67de5236 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -15,7 +15,7 @@ Source2: postscripts.tar.gz Source3: templates.tar.gz Provides: xCAT = %{version} -Requires: xCAT-server xCAT-client perl-DBD-SQLite +Requires: xCAT-server xCAT-client perl-DBD-SQLite %ifos linux Requires: atftp dhcp httpd nfs-utils expect conserver fping bind perl-XML-Parser @@ -32,12 +32,12 @@ hardware management and software management. %prep %ifos linux -tar zxvf %{SOURCE2} +tar zxf %{SOURCE2} %else rm -rf postscripts cp %{SOURCE2} /opt/freeware/src/packages/BUILD -gunzip postscripts.tar.gz -tar -xvf postscripts.tar +gunzip -f postscripts.tar.gz +tar -xf postscripts.tar %endif %build @@ -49,11 +49,11 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ cd $RPM_BUILD_ROOT/%{prefix}/share/xcat/ %ifos linux -tar zxvf %{SOURCE3} +tar zxf %{SOURCE3} %else cp %{SOURCE3} $RPM_BUILD_ROOT/%{prefix}/share/xcat -gunzip templates.tar.gz -tar -xvf templates.tar +gunzip -f templates.tar.gz +tar -xf templates.tar rm templates.tar %endif @@ -61,11 +61,11 @@ cd - cd $RPM_BUILD_ROOT/install %ifos linux -tar zxvf %{SOURCE2} +tar zxf %{SOURCE2} %else cp %{SOURCE2} $RPM_BUILD_ROOT/install -gunzip postscripts.tar.gz -tar -xvf postscripts.tar +gunzip -f postscripts.tar.gz +tar -xf postscripts.tar rm postscripts.tar %endif @@ -84,7 +84,7 @@ $RPM_INSTALL_PREFIX0/sbin/xcatconfig %else . /etc/profile.d/xcat.sh -if [ ! -f /install/postscripts/hostkeys/ssh_host_key ]; then +if [ ! -f /install/postscripts/hostkeys/ssh_host_key ]; then echo Generating SSH1 RSA Key... /usr/bin/ssh-keygen -t rsa1 -f /install/postscripts/hostkeys/ssh_host_key -C '' -N '' echo Generating SSH2 RSA Key... @@ -114,7 +114,7 @@ if [ "$1" = "1" ]; then #Only if installing for the fist time.. /etc/rc.d/init.d/nfs stop /etc/rc.d/init.d/nfs start exportfs -a - if [ ! -r /etc/xcat/site.sqlite ]; then + if [ ! -r /etc/xcat/site.sqlite ]; then XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=xcatdport site.value=3001 XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=xcatiport site.value=3002 XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=tftpdir site.value=/tftpboot @@ -123,19 +123,19 @@ if [ "$1" = "1" ]; then #Only if installing for the fist time.. XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=installdir site.value=/install XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=timezone site.value=`grep ^ZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'` fi - if [ ! -r /etc/xcat/policy.sqlite ]; then + if [ ! -r /etc/xcat/policy.sqlite ]; then XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=1 policy.name=root policy.rule=allow XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=2 policy.commands=getbmcconfig policy.rule=allow XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=3 policy.commands=nextdestiny policy.rule=allow XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=4 policy.commands=getdestiny policy.rule=allow fi - - if [ ! -d /etc/xcat/ca ]; then + + if [ ! -d /etc/xcat/ca ]; then yes | $RPM_INSTALL_PREFIX0/share/xcat/scripts/setup-xcat-ca.sh "xCAT CA" fi mkdir -p /install/postscripts/ca cp -r /etc/xcat/ca/* /install/postscripts/ca - if [ ! -d /etc/xcat/cert ]; then + if [ ! -d /etc/xcat/cert ]; then yes | $RPM_INSTALL_PREFIX0/share/xcat/scripts/setup-server-cert.sh `hostname` fi mkdir -p /install/postscripts/cert @@ -150,11 +150,11 @@ if [ "$1" = "1" ]; then #Only if installing for the fist time.. then rm /tftpboot/pxelinux.cfg/default fi - # make Management Node + # make Management Node touch /etc/xCATMN # setup syslog /install/postscripts/syslog - fi + #fi XCATROOT=$RPM_INSTALL_PREFIX0 /etc/init.d/xcatd start if [ -x $RPM_INSTALL_PREFIX0/sbin/mknb ]; then diff --git a/xCATsn/mkrpm b/xCATsn/mkrpm index fd7fbf59e..5099afa8b 100755 --- a/xCATsn/mkrpm +++ b/xCATsn/mkrpm @@ -7,8 +7,8 @@ then cd `dirname $0` echo '.svn' > /tmp/xcat-excludes - tar -X /tmp/xcat-excludes -cvf /opt/freeware/src/packages/SOURCES/license.tar LICENSE.html - gzip /opt/freeware/src/packages/SOURCES/license.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/license.tar LICENSE.html + gzip -f /opt/freeware/src/packages/SOURCES/license.tar cp xcat.conf /opt/freeware/src/packages/SOURCES rm -f /opt/freeware/src/packages/SRPMS/xCATsn-2.0*rpm /opt/freeware/src/packages/RPMS/ppc/xCATsn-2.0*rpm @@ -29,7 +29,7 @@ else fi cd `dirname $0` - tar --exclude .svn -czvf /usr/src/$pkg/SOURCES/license.tar.gz LICENSE.html + tar --exclude .svn -czf /usr/src/$pkg/SOURCES/license.tar.gz LICENSE.html cp xcat.conf /usr/src/$pkg/SOURCES rm -f /usr/src/$pkg/SRPMS/xCATsn-2.0*rpm /usr/src/$pkg/RPMS/*/xCATsn-2.0*rpm rpmbuild -ba xCATsn.spec