diff --git a/docs/source/guides/admin-guides/references/man5/postscripts.5.rst b/docs/source/guides/admin-guides/references/man5/postscripts.5.rst index a87cd902c..6bac116b9 100644 --- a/docs/source/guides/admin-guides/references/man5/postscripts.5.rst +++ b/docs/source/guides/admin-guides/references/man5/postscripts.5.rst @@ -44,13 +44,13 @@ postscripts Attributes: \ **postscripts**\ - Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. + Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. Please note that the postscripts specified for "xcatdefaults" will be assigned to node automatically, they can not be removed from "postscripts" attribute of a node with "chdef -m" command \ **postbootscripts**\ - Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attribute to run first in the list. + Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attribute to run first in the list. Please note that the postbootscripts specified for "xcatdefaults" will be assigned to node automatically, they can not be removed from "postbootscripts" attribute of a node with "chdef -m" command diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 8aea1128b..9a67dd224 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -801,13 +801,13 @@ group Attributes: \ **postbootscripts**\ (postscripts.postbootscripts) - Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attribute to run first in the list. + Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attribute to run first in the list. Please note that the postbootscripts specified for "xcatdefaults" will be assigned to node automatically, they can not be removed from "postbootscripts" attribute of a node with "chdef -m" command \ **postscripts**\ (postscripts.postscripts) - Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. + Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. Please note that the postscripts specified for "xcatdefaults" will be assigned to node automatically, they can not be removed from "postscripts" attribute of a node with "chdef -m" command diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index 77646859a..0ab71ac4d 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -807,13 +807,13 @@ node Attributes: \ **postbootscripts**\ (postscripts.postbootscripts) - Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attribute to run first in the list. + Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attribute to run first in the list. Please note that the postbootscripts specified for "xcatdefaults" will be assigned to node automatically, they can not be removed from "postbootscripts" attribute of a node with "chdef -m" command \ **postscripts**\ (postscripts.postscripts) - Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. + Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. Please note that the postscripts specified for "xcatdefaults" will be assigned to node automatically, they can not be removed from "postscripts" attribute of a node with "chdef -m" command diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index fe4864e54..4faa725b8 100755 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -675,6 +675,7 @@ sub setobjdefs # update the tables a row at a time foreach my $objname (keys %objhash) { + my $obj_need_update = 0; # get attr=val that are set in the DB ?? my $type = $objhash{$objname}{objtype}; @@ -1023,6 +1024,7 @@ sub setobjdefs $rsp->{data}->[0] = "access_tabentry \'$this_attr->{access_tabentry}\' is not valid."; xCAT::MsgUtils->message("E", $rsp, $::callback); + $objhash{$objname}{error} = 1; next; } $lookup_table = $tabentry{'lookup_table'}; @@ -1075,19 +1077,26 @@ sub setobjdefs split(/$delim/, $DBattrvals{$objname}{$attr_name}); my @minusList = split(/$delim/, $objhash{$objname}{$attr_name}); + my $operation_failed = 0; foreach my $em (@minusList) { if (!(grep { $_ eq $em } @currentList)) { if (($::opt_t eq 'group') && ($DBattrvals{$objname}{'grouptype'} ne 'dynamic')) { my $rsp; $rsp->{data}->[0] = "$objname is not a member of \'$em\'."; - xCAT::MsgUtils->message("W", $rsp, $::callback); + xCAT::MsgUtils->message("E", $rsp, $::callback); + $operation_failed = 1; } else { my $rsp; $rsp->{data}->[0] = "$em is not in the attribute of \'$attr_name\' for the \'$objname\' definition."; - xCAT::MsgUtils->message("W", $rsp, $::callback); + xCAT::MsgUtils->message("E", $rsp, $::callback); + $operation_failed = 1; } } } + if ($operation_failed) { + $objhash{$objname}{error} = 1; + next; + } # make a new list without the one specified my $first = 1; @@ -1106,6 +1115,12 @@ sub setobjdefs } $val = $newlist; } + else { + my $rsp; + $rsp->{data}->[0] = "No value got for attribute \'$attr_name\' for the \'$objname\' definition."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + next; + } } else { @@ -1118,10 +1133,13 @@ sub setobjdefs # the key is 'tabattrs' $allupdates{$lookup_table}{$objname}{$attr_name}{'tabattrs'}{$::tabattr} = $val; $setattrs = 1; - + $obj_need_update = 1; push(@setattrlist, $attr_name); } # end - foreach attribute + if ($obj_need_update) { + $objhash{$objname}{updated} = 1; + } my $rsp; foreach my $att (keys %$invalidattr) { diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index bf4816595..50241e8e5 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -893,8 +893,8 @@ passed as argument rather than by table value', table_desc => 'The scripts that should be run on each node after installation or diskless boot.', descriptions => { node => 'The node name or group name.', - postscripts => 'Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute.', - postbootscripts => 'Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attribute to run first in the list.', + postscripts => 'Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". xCAT automatically adds the postscripts from the xcatdefaults.postscripts attribute of the table to run first on the nodes after install or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. Please note that the postscripts specified for "xcatdefaults" will be assigned to node automatically, they can not be removed from "postscripts" attribute of a node with "chdef -m" command', + postbootscripts => 'Comma separated list of scripts that should be run on this node after diskful installation or diskless boot. Each script can take zero or more parameters. For example: "script1 p1 p2,script2,...". On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attribute to run first in the list. Please note that the postbootscripts specified for "xcatdefaults" will be assigned to node automatically, they can not be removed from "postbootscripts" attribute of a node with "chdef -m" command', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 8faed0d4f..5fd00c2e8 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -1999,6 +1999,18 @@ sub defmk } else { + my $nodenum = 0; + my $ret = 0; + my @nodes_updated = (); + foreach my $node (keys %::FINALATTRS) { + if ($::FINALATTRS{$node}{updated}) { + $nodenum++; + push @nodes_updated, $node; + } + if ($::FINALATTRS{$node}{error}) { + $ret = 1; + } + } if ($::verbose) { @@ -2007,7 +2019,7 @@ sub defmk xCAT::MsgUtils->message("I", $rsp, $::callback); my $n = 1; - foreach my $o (sort(keys %::FINALATTRS)) + foreach my $o (sort( @nodes_updated)) { $rsp->{data}->[$n] = "$o"; $n++; @@ -2023,21 +2035,17 @@ sub defmk xCAT::MsgUtils->message("E", $rsp, $::callback); } } - else - { - my $rsp; - my $nodenum = scalar(keys %::FINALATTRS); - $rsp->{data}->[0] = "$nodenum object definitions have been created or modified."; - if ($nodenum > 0) { - # Some objects were created, report as success - xCAT::MsgUtils->message("I", $rsp, $::callback); - } - else { - # No objects were created, report as error - xCAT::MsgUtils->message("E", $rsp, $::callback); - } + my $rsp; + $rsp->{data}->[0] = "$nodenum object definitions have been created or modified."; + if ($nodenum > 0) { + # Some objects were created, report as success + xCAT::MsgUtils->message("I", $rsp, $::callback); } - return 0; + else { + # No objects were created, report as error + xCAT::MsgUtils->message("E", $rsp, $::callback); + } + return $ret; } } @@ -2786,18 +2794,29 @@ sub defch } else { + my $nodenum = 0; + my $ret = 0; + my @nodes_updated = (); + foreach my $node (keys %::FINALATTRS) { + if ($::FINALATTRS{$node}{updated}) { + $nodenum++; + push @nodes_updated, $node; + } + if ($::FINALATTRS{$node}{error}) { + $ret = 1; + } + } if ($::verbose) { # give results my $rsp; - my $nodenum = scalar(keys %::FINALATTRS); if ($nodenum) { $rsp->{data}->[0] = "The database was updated for the following objects:"; xCAT::MsgUtils->message("I", $rsp, $::callback); my $n = 1; - foreach my $o (sort(keys %::FINALATTRS)) + foreach my $o (sort(@nodes_updated)) { $rsp->{data}->[$n] = "$o\n"; $n++; @@ -2810,7 +2829,7 @@ sub defch else { my $rsp; - my $nodenum = scalar(keys %::FINALATTRS); + if ($nodenum) { $rsp->{data}->[0] = "$nodenum object definitions have been created or modified."; } else { @@ -2842,7 +2861,7 @@ sub defch } } } - return 0; + return $ret; } }