From a391c78aaf12464aadf61ae3d3b5d6081b1922f4 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Wed, 13 Oct 2010 12:51:29 +0000 Subject: [PATCH] hydra: buildmachine disabled by default, add some default constraints --- src/lib/Hydra/Controller/Admin.pm | 5 +++-- src/sql/hydra.sql | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/Hydra/Controller/Admin.pm b/src/lib/Hydra/Controller/Admin.pm index e3f9837e..493971bd 100644 --- a/src/lib/Hydra/Controller/Admin.pm +++ b/src/lib/Hydra/Controller/Admin.pm @@ -146,14 +146,15 @@ sub create_machine_submit : Chained('admin') PathPart('create-machine/submit') A requireAdmin($c); - my $hostname = trim $c->request->params->{"hostname"}; + my $hostname = trim $c->request->params->{"hostname"}; error($c, "Invalid or empty hostname.") if $hostname eq ""; txn_do($c->model('DB')->schema, sub { my $machine = $c->model('DB::BuildMachines')->create( { hostname => $hostname }); - updateMachine($c, $machine); + updateMachine($c, $machine); }); + saveNixMachines($c); $c->res->redirect("/admin/machines"); } diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index ef613d0d..528e920a 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -487,12 +487,12 @@ create table NewsItems ( create table BuildMachines ( hostname text primary key NOT NULL, - username text NOT NULL, - ssh_key text NOT NULL, - options text NOT NULL, + username text DEFAULT '' NOT NULL, + ssh_key text DEFAULT '' NOT NULL, + options text DEFAULT '' NOT NULL, maxconcurrent integer DEFAULT 2 NOT NULL, speedfactor integer DEFAULT 1 NOT NULL, - enabled integer DEFAULT 1 NOT NULL + enabled integer DEFAULT 0 NOT NULL ); create table BuildMachineSystemTypes (