From: David Howells Date: Sat, 12 Apr 2014 14:53:25 +0000 (+0100) Subject: Implement "bos delete" X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3472f6f9b1f347c7015b3fa7aa6f5c1f5832e781;p=users%2Fdhowells%2Fkafs-utils.git Implement "bos delete" Signed-off-by: David Howells --- diff --git a/suite/commands/bos/delete.py b/suite/commands/bos/delete.py new file mode 100644 index 0000000..b0991b7 --- /dev/null +++ b/suite/commands/bos/delete.py @@ -0,0 +1,56 @@ +# +# AFS Server management toolkit: Delete a server instance +# -*- coding: utf-8 -*- +# + +__copyright__ = """ +Copyright (C) 2014 Red Hat, Inc. All Rights Reserved. +Written by David Howells (dhowells@redhat.com) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public Licence version 2 as +published by the Free Software Foundation. + +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 Licence for more details. + +You should have received a copy of the GNU General Public Licence +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +""" + +from afs.exception import AFSException +from afs.argparse import * +import kafs + +help = "Delete a server process from the BosConfig file" + +command_arguments = [ + [ "server", get_bosserver, "rs", "" ], + [ "instance", get_file_name, "rs", "" ], + [ "cell", get_cell, "os", "" ], + [ "noauth", get_auth, "fn" ], + [ "localauth", get_auth, "fn" ], + [ "verbose", get_dummy, "fn" ], + [ "encrypt", get_dummy, "fn" ], +] + +cant_combine_arguments = [ + ( "cell", "localauth" ), + ( "noauth", "localauth" ), +] + +description = r""" +Delete a server process from the BosConfig file +""" + +def main(params): + cell = params["cell"] + bos_conn = cell.open_bos_server(params["server"], params) + + try: + ret = kafs.BOZO_DeleteBnode(bos_conn, params["instance"]) + except kafs.AbortBZBUSY: + raise AFSException("can't delete running instance '" + params["instance"] + "'")