my $db = new hostdb("$RealBin/hostdb.sqlite") or die("Unable to connect to host database: $!");
my $dry_run = true;
-print "Samba Build farm managment tool\n";
-print "===============================\n";
+print "Samba Build farm management tool\n";
+print "================================\n";
my $op;
print "Please enter hostname to delete: ";
my $hostname = <>;
chomp($hostname);
- $db->deletehost($hostname) or die("Unable to create host $hostname");
+ $db->deletehost($hostname) or die("Unable to delete host $hostname");
} elsif ($op eq "modify") {
print "Please enter hostname to modify: ";
my $hostname = <>;
my $hostname = <>;
chomp($hostname);
my $host = $db->host($hostname);
+ die ("No such host $host") unless ($host);
print "Host: $host->{name}";
if ($host->{fqdn}) { print " ($host->{fqdn})"; }
print "\n";
my ($self) = @_;
$self->{dbh}->do("CREATE TABLE host ( name text, owner text, owner_email text, password text, ssh_access int, fqdn text, platform text, permission text );");
+
+ $self->{dbh}->do("CREATE UNIQUE INDEX unique_hostname ON host (name);");
}
sub createhost($$$$$$)
my $sth = $self->{dbh}->prepare("INSERT INTO host (name, platform, owner, owner_email, password, permission) VALUES (?,?,?,?,?,?)");
$sth->execute($name, $platform, $owner, $owner_email, $password, $permission);
-
- $self->{dbh}->do("CREATE UNIQUE INDEX unique_hostname ON host (name);");
}
sub deletehost($$)