cross-module change for 4.2
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 24 Jun 2008 16:12:40 +0000 (16:12 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 24 Jun 2008 16:12:40 +0000 (16:12 +0000)
- NodeManager/conf_files set node_id when invoking source URL
- nodeconfig/yum.conf.php : no functional change, but uses node_id to gather nodegroups and displays them in comments

PlanetLabConf/yum.conf.php

index 9eaf430..c15ea78 100755 (executable)
@@ -14,28 +14,7 @@ include('plc_config.php');
 $PLC_NAME = PLC_NAME;
 $PLC_BOOT_HOST = PLC_BOOT_HOST;
 
-$oldrepos = array(array('FedoraCore2Base', 'Fedora Core 2 Base', 'stock-fc2'),
-              array('FedoraCore2Updates', 'Fedora Core 2 Updates', 'updates-fc2'),
-              array('ThirdParty', 'Third Party RPMS', '3rdparty'));
-
-$repos = array(array('ThirdParty', 'Third Party RPMS', '3rdparty'));
-
-
-if (isset($_REQUEST['alpha'])) {
-  $repos[] = array('PlanetLabAlpha', 'PlanetLab Alpha RPMS', 'planetlab-alpha');
-} elseif (isset($_REQUEST['beta'])) {
-  $repos[] = array('PlanetLabBeta', 'PlanetLab Beta RPMS', 'planetlab-beta');
-} elseif (isset($_REQUEST['rollout'])) {
-  $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab-rollout');
-} else {
-  $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab');
-}
-
-if (isset($_REQUEST['gpgcheck'])) {
-  $gpgcheck = $_REQUEST['gpgcheck'];
-} else {
-  $gpgcheck = 0;
-}
+////////////////////////////// mirror list
 
 // Requesting a mirror list. Yum bombs out completely if a repository
 // is (even temporarily) unavailable, so if CoBlitz is down, provide a
@@ -84,7 +63,38 @@ if (isset($_REQUEST['mirrorlist']) &&
   exit;
 }
 
+////////////////////////////// plain yum.conf 
+
+// Get admin API handle
+require_once 'plc_api.php';
+global $adm;
+
 // Requesting yum.conf. See above for the mirrorlist definition.
+
+#$oldrepos = array(array('FedoraCore2Base', 'Fedora Core 2 Base', 'stock-fc2'),
+#             array('FedoraCore2Updates', 'Fedora Core 2 Updates', 'updates-fc2'),
+#             array('ThirdParty', 'Third Party RPMS', '3rdparty'));
+
+$repos = array(array('ThirdParty', 'Third Party RPMS', '3rdparty'));
+
+
+if (isset($_REQUEST['alpha'])) {
+  $repos[] = array('PlanetLabAlpha', 'PlanetLab Alpha RPMS', 'planetlab-alpha');
+} elseif (isset($_REQUEST['beta'])) {
+  $repos[] = array('PlanetLabBeta', 'PlanetLab Beta RPMS', 'planetlab-beta');
+} elseif (isset($_REQUEST['rollout'])) {
+  $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab-rollout');
+} else {
+  $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab');
+}
+
+if (isset($_REQUEST['gpgcheck'])) {
+  $gpgcheck = $_REQUEST['gpgcheck'];
+} else {
+  $gpgcheck = 0;
+}
+
+
 echo <<<EOF
 [main]
 # Do not scan /etc/yum.repos.d/
@@ -132,4 +142,16 @@ EOF;
   }
 }
 
+if (isset($_REQUEST['node_id'])) {
+  $node_id=intval($_REQUEST['node_id']);
+  echo "# node_id = " . $node_id . "\n";
+  # compute nodegroups
+  $nodes = $adm->GetNodes(array('node_id'=>$node_id));
+  $nodegroup_ids = $nodes[0]['nodegroup_ids'];
+  $nodegroups = $adm->GetNodeGroups($nodegroup_ids);
+  foreach ($nodegroups as $nodegroup) {
+    echo "# in nodegroup " . $nodegroup['name'] . "\n" ;
+  }
+ }
+
 ?>