newly created node can be declared 'reservable'
[www-register-wizard.git] / application / controllers / download.php
index 06e1737..843d29f 100644 (file)
@@ -11,7 +11,7 @@ include 'plc_header.php';
 
 // Common functions
 require_once 'plc_functions.php';
-require_once 'plc_sorts.php';
+require_once 'plc_config.php';
 include 'plc_objects.php';
 
 
@@ -108,7 +108,7 @@ class Download extends Controller {
                                        $basename=PLC_NAME."-BootCD.usb";
                                }
 
-                               $api->UpdateNode( $hostname, array( "boot_state" => 'disable',
+                               $api->UpdateNode( $hostname, array( "boot_state" => 'disabled',
                                                                                                        "version" => $this->get_bootcd_version() ) );
                                /* exits on success */
                                $success = $this->deliver_bootmedium($node_id, $boot_action, $basename);
@@ -140,7 +140,7 @@ class Download extends Controller {
                                }
 
                                $hostname= $node_detail['hostname'];
-                               $return= $api->GetNodeNetworks( array( "node_id" => $node_id ), NULL );
+                               $return= $api->GetInterfaces( array( "node_id" => $node_id ), NULL );
                   
                                $can_gen_config= 1;
                                $data['has_primary']= 0;
@@ -216,7 +216,7 @@ class Download extends Controller {
                                        }        
                                        if ($action != 'download-node-floppy')
                                        {
-                                               $api->UpdateNode( $hostname, array( "boot_state" => 'disable',
+                                               $api->UpdateNode( $hostname, array( "boot_state" => 'disabled',
                                                                                  "version" => $this->get_bootcd_version() ) );
                                        }
                                        /* exits on success */
@@ -251,7 +251,16 @@ class Download extends Controller {
        }
        function get_bootcd_version()
        {
-               $BOOTCD="/usr/share/bootcd";
+               // pick default bootcd flavors. need more flexibility
+               // TODO: find a way to handle 32/64 bit.
+               if ( defined("PLC_FLAVOUR_NODE_PLDISTRO") )
+               {
+                       // This approach only works for 5.0
+                       $BOOTCD = "/usr/share/bootcd-" . PLC_FLAVOUR_NODE_PLDISTRO . "-" . PLC_FLAVOUR_NODE_FCDISTRO . "-" . PLC_FLAVOUR_NODE_ARCH;
+               } else {
+                       $BOOTCD = exec ("ls -d /usr/share/bootcd*");
+               }
+
                $BOOTCDVERSION="$BOOTCD/build/version.txt";
                $version = trim(file_get_contents($BOOTCDVERSION));
                $bootcd_version = PLC_NAME . "-BootCD-".$version;
@@ -261,7 +270,7 @@ class Download extends Controller {
        function deliver_bootmedium($node_id, $action, $filename)
        {
                global $api;
-               ini_set("memory_limit","300M");
+               ini_set("memory_limit","450M");
                $options = array();
                switch ($action) {
                        case "node-usb-partition":