[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/ricci/modules/rpm PackageHandler.cpp



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic sourceware org	2006-09-26 00:56:13

Modified files:
	ricci/modules/rpm: PackageHandler.cpp 

Log message:
	rpm module: fix of RHEL5 support

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/PackageHandler.cpp.diff?cvsroot=cluster&r1=1.5&r2=1.6

--- conga/ricci/modules/rpm/PackageHandler.cpp	2006/08/15 00:06:48	1.5
+++ conga/ricci/modules/rpm/PackageHandler.cpp	2006/09/26 00:56:13	1.6
@@ -66,7 +66,8 @@
     if (access("/etc/sysconfig/rhn/systemid", F_OK))
       rhn_available = false;
     // check if there are subscribed channels
-    if (rhn_available) {
+    if (rhn_available && 
+	RHEL4) {
       String out, err;
       int status;
       vector<String> args;
@@ -92,13 +93,10 @@
   if (!available())
     return rpms;
   
-  String out, err;
-  int status;
-  vector<String> args;
-  
-  if (RHEL4 || RHEL5) {
-    out = err = "";
-    args.clear();
+  if (RHEL4) {
+    String out, err;
+    int status;
+    vector<String> args;
     args.push_back("--showall");
     if (utils::execute(UP2DATE_PATH, args, out, err, status, false))
       throw String("execute failed");
@@ -119,9 +117,10 @@
       rpms[name] = version;
     }
     
-  } else if (FC5 || FC6) {
-    out = err = "";
-    args.clear();
+  } else if (FC5 || FC6 || RHEL5) {
+    String out, err;
+    int status;
+    vector<String> args;
     args.push_back("-y");
     args.push_back("list");
     args.push_back("all");
@@ -159,13 +158,10 @@
   if (rpms.empty())
     return true;
   
-  String out, err;
-  int status;
-  vector<String> args;
-  
-  if (RHEL4 || RHEL5) {
-    out = err = "";
-    args.clear();
+  if (RHEL4) {
+    String out, err;
+    int status;
+    vector<String> args;
     for (vector<String>::size_type i=0; i<rpms.size(); i++)
       args.push_back(rpms[i]);
     if (utils::execute(UP2DATE_PATH, args, out, err, status, true))
@@ -174,17 +170,18 @@
       throw String(UP2DATE_PATH) + " failed";
     return true;
     
-  } else if (FC5 || FC6) {
+  } else if (FC5 || FC6 || RHEL5) {
     // install
     vector<String> rpms_to_install;
-    out = err = "";
-    args.clear();
+    String out, err;
+    int status;
+    vector<String> args;
     args.push_back("-y");
     args.push_back("list");
     args.push_back("installed");
     if (utils::execute(YUM_PATH, args, out, err, status, false))
       throw String("execute failed");
-    if (status != 0)
+    if (status)
       return false;
     vector<String> lines = utils::split(utils::strip(out), "\n");
     for (vector<String>::const_iterator rpm = rpms.begin();
@@ -213,7 +210,7 @@
 	args.push_back(*rpm);
       if (utils::execute(YUM_PATH, args, out, err, status, false))
 	throw String("execute failed");
-      if (status != 0)
+      if (status)
 	return false;
     }
     // update
@@ -227,9 +224,7 @@
       args.push_back(*rpm);
     if (utils::execute(YUM_PATH, args, out, err, status, false))
       throw String("execute failed");
-    if (status != 0)
-      return false;
-    return true;
+    return !status;
     
   } else 
     return false;
@@ -500,9 +495,11 @@
     }
   } else if (RHEL5 || FC6) {
     set.packages.push_back("gfs2-utils");
-    
-    // TODO: implement GFS1
-    
+    // GFS1 not present on FC6
+    if (RHEL5) {
+      set.packages.push_back("gfs-utils");
+      set.packages.push_back("kmod-gfs");
+    }
   }
   
   return set;
@@ -625,8 +622,7 @@
       is.read(buff, length);
       
       String rel(buff, length);
-      delete [] buff;
-      buff = 0;
+      delete [] buff; buff = 0;
       
       release = utils::strip(rel);
     } catch ( ... ) {
@@ -640,9 +636,12 @@
       FC5 = true;
     else if (release.find("Fedora Core") != release.npos &&
 	     release.find("6") != release.npos)
-      // TODO: detect FC6
+      // TODO: get real FC6 codename
       FC6 = true;
-    // TODO: detect RHEL5
+    else if (release.find("Tikanga") != release.npos)
+      RHEL5 = true;
+    else
+      throw String("Unsupported OS");
     
     release_set = true;
   }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]