3 // part of yum config on nodes
6 // Copyright (C) 2008 INRIA
8 // $Id: myplc.repo.php 9818 2008-07-04 07:54:06Z thierry $
11 // For PLC_NAME and PLC_BOOT_HOST
12 include('plc_config.php');
15 $PLC_BOOT_HOST = PLC_BOOT_HOST;
17 // Get admin API handle
18 require_once 'plc_api.php';
21 if (isset($_REQUEST['gpgcheck'])) {
22 $gpgcheck = $_REQUEST['gpgcheck'];
28 if ( ! isset($_REQUEST['slicefamily'])) {
29 # legacy : use the old naming scheme
30 $nodefamily="planetlab";
31 $pldistro="planetlab";
33 $slicefamily = $_REQUEST['slicefamily'];
34 echo "# slicefamily $slicefamily \n" ;
35 list( $pldistro, $fcdistro, $arch) = split ("-", $slicefamily);
36 $nodefamily = "$pldistro-$arch";
37 echo "# nodefamily $nodefamily \n" ;
40 # the nodegroups the node is part of
41 $nodegroup_names=array();
44 if ( ! isset($_REQUEST['node_id'])) {
45 print "# Warning : node_id not set\n";
47 $node_id=intval($_REQUEST['node_id']);
48 echo "# node_id $node_id \n";
50 $nodes = $adm->GetNodes(array('node_id'=>$node_id));
51 $nodegroup_ids = $nodes[0]['nodegroup_ids'];
52 $nodegroups = $adm->GetNodeGroups($nodegroup_ids);
53 foreach ($nodegroups as $nodegroup) {
54 $nodegroup_name = $nodegroup['groupname'];
55 $nodegroup_names [] = $nodegroup_name;
56 echo "# in nodegroup $nodegroup_name \n" ;
58 $node_tag_ids = $nodes[0]['node_tag_ids'];
59 $node_tags = $adm->GetNodeTags($node_tag_ids);
60 foreach ($node_tags as $node_tag) {
61 if ($node_tag['tagname'] == 'deployment') {
62 $deployment = $node_tag['value'];
68 $topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/";
69 $topurl="https://$PLC_BOOT_HOST" . "/install-rpms/";
71 if ($deployment == 'alpha') {
72 $topdir = $topdir . "alpha/";
73 $topurl = $topurl . "alpha/";
76 # locate the planetlab repo for this node family & nodegroup
78 foreach ($nodegroup_names as $nodegroup_name) {
79 $groupdir = "$nodefamily-$nodegroup_name";
80 # have we got a repo like /install-rpms/planetlab-i386-alpha ?
81 echo "# trying " . $topdir . $groupdir . "\n";
82 if (is_dir (realpath($topdir . $groupdir))) {
83 $repo=array($pldistro, $groupdir, "$PLC_NAME $nodefamily $nodegroup_name");
90 echo "# trying default " . $topdir . $nodefamily . "\n";
91 if (is_dir (realpath($topdir . $nodefamily))) {
92 $repo = array($pldistro, $nodefamily, "$PLC_NAME $nodefamily regular");
96 # default: if we're here it's probably very wrong
98 echo "# WARNING: could not find a decent planetlab repo for this node\n";
99 $repo = array ($pldistro, "planetlab", "default probably wrong");
100 # don't define the repo in this case
104 list( $id, $dir, $name) = $repo;
106 echo <<< __PLC_REPO__