<s> import subprocess <EOL> import os <EOL> from logging import info <EOL> import sys <EOL> from servi . command import Command <EOL> import servi . config as c <EOL> from servi . utils import timeit <EOL> from servi . exceptions import ServiError <EOL> def get_servi_inventory_path ( ) : <EOL> try : <EOL> servi_inventory = subprocess . check_output ( '<STR_LIT>' , shell = True , <EOL> universal_newlines = True ) <EOL> except subprocess . CalledProcessError : <EOL> raise ServiError ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( sys . path ) ) <EOL> servi_inventory = servi_inventory . strip ( ) <EOL> return servi_inventory <EOL> class LansCommand ( Command ) : <EOL> def __init__ ( self ) : <EOL> super ( ) . __init__ ( ) <EOL> self . special = { "<STR_LIT>" : True } <EOL> def register_command_line ( self , sub_parsers ) : <EOL> parser = sub_parsers . add_parser ( <EOL> '<STR_LIT>' , help = "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> description = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , help = <EOL> '<STR_LIT>' ) <EOL> parser . set_defaults ( command_func = self . run ) <EOL> def run ( self , args , extra_args ) : <EOL> proj_only = [ '<STR_LIT>' , '<STR_LIT>' ] if args . project_only else [ ] <EOL> cmd_line = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , get_servi_inventory_path ( ) , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , c . MAIN_USERNAME , <EOL> '<STR_LIT>' , c . MAIN_RSA_KEY_FILE , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> ] + proj_only + extra_args <EOL> info ( '<STR_LIT>' <EOL> . format ( '<STR_LIT:U+0020>' . join ( cmd_line ) , <EOL> os . path . join ( c . MASTER_DIR , '<STR_LIT>' ) ) ) <EOL> with timeit ( ) : <EOL> retval = subprocess . call ( <EOL> cmd_line , cwd = os . path . join ( c . MASTER_DIR , '<STR_LIT>' ) ) <EOL> return not retval <EOL> command = LansCommand ( ) </s>
