From: <di...@os...> - 2005-12-31 05:09:37
|
Author: dikim Date: 2005-12-31 00:09:27 -0500 (Sat, 31 Dec 2005) New Revision: 4098 Modified: trunk/scripts/package_config_xmls_to_database trunk/scripts/populate_default_package_set Log: Fix the bug of "Selected packages wrong when install_cluster is re-run" Modified: trunk/scripts/package_config_xmls_to_database =================================================================== --- trunk/scripts/package_config_xmls_to_database 2005-12-31 03:26:39 UTC (rev 4097) +++ trunk/scripts/package_config_xmls_to_database 2005-12-31 05:09:27 UTC (rev 4098) @@ -454,7 +454,7 @@ $msg = ""; $xml_ref = get_xml_ref($directory, $package,$msg); if( is_installed($package,$package_version) ){ - my @list_of_tables = ("Packages_rpmlists", "Group_Packages", + my @list_of_tables = ("Packages_rpmlists", "Packages_conflicts", "Packages_provides", "Packages_requires", "Packages_servicelists", "Packages_switcher"); @@ -490,7 +490,14 @@ } } } +my @nics_results = (); +my $server_node = "oscar_server"; +# Determine if it is the first time installation or not. +# If nics table is already filled in, this is not first time installation +# and skip the process of inserting into the Group_Packages table. +get_nics_info_with_node($server_node,\@nics_results,\%options,\@error_strings); + foreach my $directory ( @directories ) { my $package = $directory; $package =~ s,^.*/,,; @@ -517,7 +524,7 @@ # The newly downloaded packages is not determined to # add to the selected "Group" (i.e., Default). my %field_value_hash = (); - if ( ! $directory_argument ){ + if ( ! $directory_argument && !@nics_results ){ %field_value_hash = ( "group_name"=>$DEFAULT, "package_id"=>"$package_id", "selected" => 1); Modified: trunk/scripts/populate_default_package_set =================================================================== --- trunk/scripts/populate_default_package_set 2005-12-31 03:26:39 UTC (rev 4097) +++ trunk/scripts/populate_default_package_set 2005-12-31 05:09:27 UTC (rev 4098) @@ -33,6 +33,19 @@ use OSCAR::Package; use oda; +my %options = (); +my @errors = (); + +my @nics_results = (); +my $server_node = "oscar_server"; + +# Determine if it is the first time installation or not. +# If nics table is already filled in, this is not first time installation. +# and skip the whole process of this script (populate_default_package_set). +get_nics_info_with_node($server_node,\@nics_results,\%options,\@errors); +exit 0 if(@nics_results); + + # name of default packages set my $DEFAULT = "Default"; @@ -52,8 +65,6 @@ my @tables =("Cluster","Nodes", "Packages", "Node_Package_Status", "Node_Packages", "Group_Packages", "Groups"); -my %options = (); -my @errors = (); if(! locking("write", \%options, \@tables, \@errors)){ die "$0: cannot connect to oda database"; } @@ -75,7 +86,7 @@ my $success = 1; if ( @package_set_names ) { -# If the default package set is already setup, do nothing. + # If the default package set is already setup, do nothing. } else { # create an empty default package set print "Creating new empty package set <$DEFAULT>\n"; @@ -121,7 +132,7 @@ my @results = (); select_table(\%options,$table,\@fields,$where,\@results,\@errors); if(! @results ){ - if ( !($is_excluded{$package_name}) ) { + if ( !($is_excluded{$package_name}) ) { insert_into_table (\%options,$table,\%field_value_hash,\@errors); } else { set_group_packages( |