2 # -*- coding: utf-8 -*-
4 # This file is part of Karesansui.
6 # Copyright (C) 2010 HDE, Inc.
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License
10 # as published by the Free Software Foundation; either version 2
11 # of the License, or (at your option) any later version.
18 from optparse import OptionParser
20 from ksscommand import KssCommand, KssCommandException, KssCommandOptException
25 from karesansui import __version__
26 from karesansui.lib.utils import load_locale, execute_command
27 from karesansui.lib.const import NETWORK_COMMAND
30 print >>sys.stderr, "[Error] karesansui package was not found."
35 usage = '%prog [options]'
38 optp = OptionParser(usage=usage, version=__version__)
39 return optp.parse_args()
44 class RestartNetworkInterface(KssCommand):
47 (opts, args) = getopts()
51 network_restart_cmd = (NETWORK_COMMAND,
54 (rc, res) = execute_command(network_restart_cmd)
56 raise KssCommandException('Failure restart network.')
60 if __name__ == "__main__":
61 target = RestartNetworkInterface()
62 sys.exit(target.run())