machines: Read /etc/nix.machines instead of using the BuildMachines table

[?]
Mar 4, 2013, 9:03 PM
IQ5NESOOULVKGJUTRI5OWLMNCSIASMBKHNVD6ANU4W3ROYWBGCDAC

Dependencies

  • [2] JARRBLZD Bootstrapify the Hydra forms (except the project and jobset edit pages)
  • [3] SMTMFEKE hydra: add missing templates
  • [4] 3PNG7NIB Remove trailing whitespace
  • [5] R2PON6R7 Allow non-admin users to see the machine status page
  • [6] SZYDW2DG hydra: added some user admin
  • [7] SMCOU72F hydra: add some admin for adding/enabling/etc build machines
  • [*] ZWCTAZGL added newsitems, added some admin options to clear various caches.

Change contents

  • replacement in src/lib/Hydra/Controller/Admin.pm at line 59
    [3.1580][3.1580:1938]()
    $c->stash->{machines} = [$c->model('DB::BuildMachines')->search({}, {order_by => "hostname"})];
    $c->stash->{systems} = [$c->model('DB::SystemTypes')->search({}, {select => ["system"], order_by => "system" })];
    $c->stash->{nixMachines} = nixMachines($c);
    $c->stash->{nixMachinesWritable} = (-e "/etc/nix.machines" && -w "/etc/nix.machines");
    [3.1580]
    [3.1938]
    $c->stash->{machines} = getMachines;
  • replacement in src/root/machines.tt at line 11
    [2.13416][3.2725:2796](),[3.2725][3.2725:2796]()
    [% FOREACH s IN systems %]<th>[% s.system %]</th>[% END %]
    [2.13416]
    [3.2796]
    <th>Systems</th>
  • replacement in src/root/machines.tt at line 17
    [3.2884][3.2884:3162](),[3.3162][2.13417:13549](),[2.13549][3.3308:3821](),[3.3308][3.3308:3821]()
    <td><input type="checkbox" name="enabled" [% IF m.enabled == 1 %]CHECKED[% END %] onclick="window.location='[% IF m.enabled == 1 %][%c.uri_for('/admin/machine' m.hostname 'disable' )%][% ELSE %][%c.uri_for('/admin/machine' m.hostname 'enable' )%][% END %]'"/></td>
    <td><a href="[% c.uri_for(c.controller('Admin').action_for('machine_edit'), [m.hostname]) %]">[% m.hostname %]</a></td>
    <td>[% m.maxconcurrent %]</td>
    <td>[% m.speedfactor %]</td>
    [% FOREACH s IN systems %]
    <td>
    [% checked = false %]
    [% FOREACH ms IN m.buildmachinesystemtypes %]
    [% checked = ms.system == s.system %]
    [% BREAK IF checked %]
    [% END %]
    <input type="checkbox" name="system" DISABLED [% IF checked %]CHECKED[% END %]/>
    </td>
    [% END %]
    [3.2884]
    [3.3821]
    <td><input type="checkbox" name="enabled" [% IF m.value.maxJobs > 0 %]CHECKED[% END %] disabled="true" /></td>
    <td>[% m.key %]</a></td>
    <td>[% m.value.maxJobs %]</td>
    <td>[% m.value.speedFactor %]</td>
    <td>
    [% comma=0; FOREACH system IN m.value.systemTypes %][% IF comma; %], [% ELSE; comma = 1; END; system; END %]
    </td>
  • edit in src/root/machines.tt at line 30
    [3.3993][2.13550:13695](),[3.4145][3.4145:4146]()
    <p><a class="btn" href="[% c.uri_for(c.controller('Admin').action_for('create_machine')) %]"><i class="icon-plus"></i> Add a new machine</a></p>