summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--moria/jobformatpossibility.txt18
-rw-r--r--moria/scire3.sql20
-rw-r--r--moria/scire_client_backend_details.txt5
-rw-r--r--moria/scire_server_backend_details.txt45
-rw-r--r--webgli/bootloader.php59
6 files changed, 115 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 91770d9..33b6c9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
# Copyright 2006-2006 Gentoo Foundation; Distributed under the GPL v2
# $Id$
+ 05 May 2006; Preston Cody <codeman@gentoo.org> ChangeLog:
+ adding a few documents to moria since that seems like a good
+ place to put them
+
23 Apr 2006; Preston Cody <codeman@gentoo.org> ChangeLog:
webgli: adding portage screen
diff --git a/moria/jobformatpossibility.txt b/moria/jobformatpossibility.txt
new file mode 100644
index 0000000..127938a
--- /dev/null
+++ b/moria/jobformatpossibility.txt
@@ -0,0 +1,18 @@
+Scire Job XML format
+<scire-job>
+ <job_id>105</job_id>
+ <priority>5</priority>
+ <permission>updates</permission>
+ <job_type>certified predefined script</job_type>
+ <script>CDATA[emerge -u apache] </script>
+ <created_by>codeman</created_by>
+ <time_created>113547113</time_created>
+ <deploy_time>113600314</deploy_time>
+</scire-job>
+
+response:
+<scire-job-response>
+ <job_id>105</job_id>
+ <status>failed</status>
+ <details>CDATA[!!! error src_compile]</details>
+</scire-job-response>
diff --git a/moria/scire3.sql b/moria/scire3.sql
new file mode 100644
index 0000000..0f2007b
--- /dev/null
+++ b/moria/scire3.sql
@@ -0,0 +1,20 @@
+drop table if exists user_pref;
+create table user_pref (
+user_id INT NOT NULL,
+jobs_layout VARCHAR(250),
+jobs_fields VARCHAR(250),
+PRIMARY KEY (user_id)
+) Type=MyISAM;
+--example. user_id = 1234
+-- jobs_layout = csv of field_ids = "5,7,8,1,2,55,24"
+-- jobs_fields = csv of sort order+direction. 0 = not sorted. = "0a,0a,1d,3a,2d,0a,0a"
+
+drop table if exists jobs_fields;
+create table jobs_fields (
+field_id INT NOT NULL,
+field_name VARCHAR(50),
+field_desc VARCHAR(200),
+PRIMARY KEY (field_id)
+) Type=MyISAM;
+--example (5, "Priority", "Shows the priority of the job.")
+
diff --git a/moria/scire_client_backend_details.txt b/moria/scire_client_backend_details.txt
new file mode 100644
index 0000000..1e71b0f
--- /dev/null
+++ b/moria/scire_client_backend_details.txt
@@ -0,0 +1,5 @@
+The client program will be made as simple as possible, keeping the duplication of code to a minimum while allowing full functional control of the client machine. The RPC calls that the client program will make will need to be locked with a semaphore because the program will have multiple processes. The client program can be run in two modes, daemon and normal. In daemon mode, the client will start the XMLRPC server and keep it active indefinitatly. This mode will accept poll_now requests from the scire server. In normal mode, there will be a process of steps that will execute and then the program will end.
+
+The program will fork off a subprocess to handle polling and downloading of jobs. This process will register and make an RPC call to the scire server asking for jobs. If the scire server replies with jobs it will download the XML file and save it in the queue. When done downloading all jobs, the polling process will sleep for the interval of the poll_interval variable. After that time if the main process is not currently making an RPC call, and the client program is still running, it will poll the scire server again for jobs. This procedure will continue as long as the program is running.
+
+The main thread will stat the queue directory after forking the polling subprocess. It will look in sorted order at the queue and if it finds a job it will take the highest priority, oldest job first. When the job is complete it will send an RPC call (or wait until it is able to) to the scire server updating the status of the job, and then stat the queue directory again and execute the next job (if there is one). In normal mode it will continue in this process until at least one poll/download has completed and there are no remaining jobs and then quit. In daemon mode it will continue until stopped. \ No newline at end of file
diff --git a/moria/scire_server_backend_details.txt b/moria/scire_server_backend_details.txt
new file mode 100644
index 0000000..0bcdbc8
--- /dev/null
+++ b/moria/scire_server_backend_details.txt
@@ -0,0 +1,45 @@
+Scire Server Backend Design Details:
+
+Single points of failure:
+Database. workaround: db replication
+one server daemon. workaround: run multiple server daemons connecting to the
+same databse. The configuration scripts will be made to handle failing over
+from a primary server daemon to an alternate.
+
+On startup, the server will need to check and deal with the possibility that
+it needs to recover from failure. This could include making a query to check
+for jobs that are to be sent to client programs running in daemon mode.
+This could also include checking for jobs that were sent but did not return a
+response saying they were received.
+
+After recovery procedures, the server program will start the XMLRPC server
+(over a secure socket of course), register itself to the network, and await
+connections.
+
+If a client program is configured to run in daemon mode (which is not
+advised), and a job is "pushed" to a client, this is done by sending a small
+RPC to the client program demanding that it ask for work immediately rather
+than on its normal schedule.
+
+Clients will be able to register/connect to the XMLRPC server for many
+purposes. Most will be to either ask for work or to report the status of a
+job that was sent to a client.
+
+Asking for work:
+When a client program registers and makes a connection to the server, it will
+fork a thread on the server program for that client. Max-threads will be
+define-able if necessary. Inside the thread, a query will be made to the
+database to find jobs waiting to be sent to that client. All pending jobs
+will be then checked against the ACL for the correct permissions. If the
+check fails, update the status in the database and log accordingly. If the
+check passes, reply to the client RPC by creating an XML job file on the fly
+from the contents of the database row. Await a reply from the client that it
+received this job and is waiting for more jobs. Send more jobs accordingly.
+If the client does not reply saying it receives a message, ???
+
+Updating the status of a job:
+Don't know about threads here. May not be necessary. The client will connect
+and state the job id# and the status of that job in an XML file. The server
+program will parse and process the contents and update the database. The
+server program will then reply to the client acknowledging the receipt of the
+status message.
diff --git a/webgli/bootloader.php b/webgli/bootloader.php
index cd210ca..719042d 100644
--- a/webgli/bootloader.php
+++ b/webgli/bootloader.php
@@ -1,56 +1,43 @@
<?php
+
include('webgliIP.php');
-if (!isset($_SESSION['install_profile'])) {
- print "must set install profile. doing so now.";
- session_start();
- $_SESSION['install_profile'] = new InstallProfile;
- session_write_close();
-}
-print_r( $_SESSION);
-#return 0;
-#session_unset();
-$ip = $_SESSION['install_profile'];
-print "<br><br>".$ip->boot_loader_pkg;
+include('webgliUtility.php');
include('Smarty.class.php');
$smarty = new Smarty;
-#phpinfo();
+
$smarty->template_dir = './templates';
$smarty->compile_dir = './templates_c';
$smarty->cache_dir = './cache';
$smarty->config_dir = './configs';
-
+
+$ip = new InstallProfile();
+$ip->parse('test.xml');
+
$error_msg = "";
+
if ($_POST['setbootloader']) {
if ($_POST['bootloader']) {
- //try:
- $_SESSION['install_profile']->set_boot_loader_pkg($_POST['bootloader']) or
- // except:
- $error_msg .= "ERROR: Could not set the bootloader pkg!";
+ $ip->set("bootloader_pkg",$_POST['bootloader']) or
+ $error_msg .= "ERROR: Could not set the bootloader pkg!";
}
if ($_POST['bootmbr']) {
- //try:
- $_SESSION['install_profile']['bootmbr'] = $_POST['bootmbr'] or
- $error_msg .= "ERROR: Could not set the bootloader MBR flag to TRUE";
- if ($_POST['boot_drive_choice']) {
- //try:
- $_SESSION['install_profile']['boot_drive_choice'] = $_POST['boot_drive_choice'] or
- $error_msg .= "ERROR! Could not set the boot device! ".$_POST['boot_drive_choice'];
- //except:
- }
+ $ip->set("bootloader_mbr",True) or
+ $error_msg .= "ERROR: Could not set the bootloader MBR flag to TRUE";
+ if ($_POST['boot_drive_choice']) {
+ $ip->set("boot_device",$_POST['boot_drive_choice']) or
+ $error_msg .= "ERROR! Could not set the boot device! ".$_POST['boot_drive_choice'];
+ }
}
else {
- //try:
- $_SESSION['install_profile']['bootmbr'] = False or
- //except:
- $error_msg .= "ERROR: Could not set the bootloader MBR flag to FALSE.";
- if ($_POST['bootargs']) {
- //try:
- $_SESSION['install_profile']['bootargs'] = $_POST['bootargs'] or
- //except:
- $error_msg .= "ERROR: Could not set the bootloader kernel arguments!";
- }
+ $ip->set("bootloader_mbr",False) or
+ $error_msg .= "ERROR: Could not set the bootloader MBR flag to FALSE.";
}
+ if ($_POST['bootargs']) {
+ $ip->set("bootloader_kernel_args",$_POST['bootargs']) or
+ $error_msg .= "ERROR: Could not set the bootloader kernel arguments!";
+ }
+
if (!$error_msg) {
$error_msg = "Values saved successfully";
}