<s> import os <EOL> import sys <EOL> import logging <EOL> import fcntl <EOL> from optparse import OptionParser <EOL> from ksscommand import KssCommand , KssCommandException , KssCommandOptException <EOL> import __cmd__ <EOL> try : <EOL> import karesansui <EOL> from karesansui import __version__ <EOL> from karesansui . lib . utils import load_locale , execute_command <EOL> from karesansui . lib . const import NETWORK_COMMAND <EOL> except ImportError , e : <EOL> print >> sys . stderr , "<STR_LIT>" % e <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> _ = load_locale ( ) <EOL> usage = '<STR_LIT>' <EOL> def getopts ( ) : <EOL> optp = OptionParser ( usage = usage , version = __version__ ) <EOL> return optp . parse_args ( ) <EOL> def chkopts ( opts ) : <EOL> return True <EOL> class RestartNetworkInterface ( KssCommand ) : <EOL> def process ( self ) : <EOL> ( opts , args ) = getopts ( ) <EOL> chkopts ( opts ) <EOL> self . up_progress ( <NUM_LIT:10> ) <EOL> network_restart_cmd = ( NETWORK_COMMAND , <EOL> "<STR_LIT>" , <EOL> ) <EOL> ( rc , res ) = execute_command ( network_restart_cmd ) <EOL> if rc != <NUM_LIT:0> : <EOL> raise KssCommandException ( '<STR_LIT>' ) <EOL> return True <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> target = RestartNetworkInterface ( ) <EOL> sys . exit ( target . run ( ) ) </s>
