- database versioning with migrate
- backend for domains - settings for immutable things and config encapsulation git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@229 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
0d12afc71e
commit
3f4457bdca
22 changed files with 432 additions and 50 deletions
|
@ -24,4 +24,4 @@
|
|||
This package provides modules for the command line interface of the
|
||||
gnuviechadmin server administration suite."""
|
||||
|
||||
__all__ = ["client", "sysuser"]
|
||||
__all__ = ["client", "sysuser", "domain", "record"]
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
import CliCommand, sys
|
||||
|
||||
class ClientCli(CliCommand.CliCommand):
|
||||
"""Command line interface command for client managament."""
|
||||
"""Command line interface command for client management."""
|
||||
|
||||
name = "client"
|
||||
description = "manage clients"
|
||||
|
|
66
gnuviechadmin/cli/domain.py
Normal file
66
gnuviechadmin/cli/domain.py
Normal file
|
@ -0,0 +1,66 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007 by Jan Dittberner.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
# Version: $Id$
|
||||
|
||||
import CliCommand, sys
|
||||
|
||||
class DomainCli(CliCommand.CliCommand):
|
||||
"""Command line interface command for domain management."""
|
||||
|
||||
name = "domain"
|
||||
description = "manage domains"
|
||||
_optionmap = {
|
||||
'create' : ("creates a new domain",
|
||||
[(["-n", "--name"], "name",
|
||||
"the domain name", True),
|
||||
(["-t", "--type"], "type",
|
||||
"domain type m for master or s for slave", False),
|
||||
(["-m", "--master"], "master",
|
||||
"master server for slave domains", False),
|
||||
(["-s", "--sysuserid"], "sysuserid",
|
||||
"system user id", True)]),
|
||||
'list' : ("lists existing domains",
|
||||
[]),
|
||||
'delete' : ("delete a domain",
|
||||
[(["-d", "--domainid"], "domainid",
|
||||
"the domain id", True)])}
|
||||
|
||||
def _execute(self, subcommand):
|
||||
from gnuviechadmin.backend.domain import DomainHandler
|
||||
from gnuviechadmin import exceptions
|
||||
if subcommand == "create":
|
||||
try:
|
||||
mydomain = DomainHandler(self._verbose).create(
|
||||
**self._data)
|
||||
if self._verbose:
|
||||
print mydomain
|
||||
except exceptions.CreationFailedError, cfe:
|
||||
self._usage()
|
||||
print cfe
|
||||
sys.exit(2)
|
||||
elif subcommand == "list":
|
||||
domains = DomainHandler(self._verbose).fetchall()
|
||||
for domain in domains:
|
||||
print domain
|
||||
elif subcommand == "delete":
|
||||
DomainHandler(self._verbose).delete(self._data["domainid"])
|
||||
|
||||
def __init__(self, argv):
|
||||
CliCommand.CliCommand.__init__(self, argv)
|
70
gnuviechadmin/cli/record.py
Normal file
70
gnuviechadmin/cli/record.py
Normal file
|
@ -0,0 +1,70 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007 by Jan Dittberner.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
# Version: $Id$
|
||||
|
||||
import CliCommand, sys
|
||||
|
||||
class RecordCli(CliCommand.CliCommand):
|
||||
"""Command line interface command for DNS record management."""
|
||||
|
||||
name = "record"
|
||||
description = "manage DNS records"
|
||||
_optionmap = {
|
||||
'create' : ("creates a new record",
|
||||
[(["-n", "--name"], "name",
|
||||
"the record name", True),
|
||||
(["-t", "--type"], "type",
|
||||
"record type", True),
|
||||
(["-c", "--content"], "content",
|
||||
"record content", True),
|
||||
(["-p", "--prio"], "prio",
|
||||
"MX record priority", False),
|
||||
(["--ttl"], "ttl",
|
||||
"Time to live", False),
|
||||
(["-d", "--domainid"], "domainid",
|
||||
"Domain id", True)]),
|
||||
'list' : ("lists existing records",
|
||||
[]),
|
||||
'delete' : ("delete a record",
|
||||
[(["-r", "--recordid"], "recordid",
|
||||
"the record id", True)])}
|
||||
|
||||
def _execute(self, subcommand):
|
||||
from gnuviechadmin.backend.record import RecordHandler
|
||||
from gnuviechadmin import exceptions
|
||||
if subcommand == "create":
|
||||
try:
|
||||
myrecord = RecordHandler(self._verbose).create(
|
||||
**self._data)
|
||||
if self._verbose:
|
||||
print myrecord
|
||||
except exceptions.CreationFailedError, cfe:
|
||||
self._usage()
|
||||
print cfe
|
||||
sys.exit(2)
|
||||
elif subcommand == "list":
|
||||
records = RecordHandler(self._verbose).fetchall()
|
||||
for record in records:
|
||||
print record
|
||||
elif subcommand == "delete":
|
||||
RecordHandler(self._verbose).delete(self._data["recordid"])
|
||||
|
||||
def __init__(self, argv):
|
||||
CliCommand.CliCommand.__init__(self, argv)
|
Loading…
Add table
Add a link
Reference in a new issue