#NEWLINE# def main( ) : #NEWLINE# #INDENT# parser = argparse . ArgumentParser ( description = _ ( 'nova-idmapshift is a tool that properly sets the ownership of a filesystem for use with linux user namespaces.  This tool can only be used with linux lxc containers.  See the man page for details.' ) ) #NEWLINE# parser . add_argument ( 'path' ) #NEWLINE# parser . add_argument ( '-u' , '--uid' , type = id_map_type , default = [ ] ) #NEWLINE# parser . add_argument ( '-g' , '--gid' , type = id_map_type , default = [ ] ) #NEWLINE# parser . add_argument ( '-n' , '--nobody' , default = NOBODY_ID , type = int ) #NEWLINE# parser . add_argument ( '-i' , '--idempotent' , action = 'store_true' ) #NEWLINE# parser . add_argument ( '-c' , '--confirm' , action = 'store_true' ) #NEWLINE# parser . add_argument ( '-d' , '--dry-run' , action = 'store_true' ) #NEWLINE# parser . add_argument ( '-v' , '--verbose' , action = 'store_true' ) #NEWLINE# args = parser . parse_args ( ) #NEWLINE# if ( args . idempotent or args . confirm ) : #NEWLINE# #INDENT# if confirm_dir ( args . path , args . uid , args . gid , args . nobody ) : #NEWLINE# #INDENT# sys . exit ( 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if args . confirm : #NEWLINE# #INDENT# sys . exit ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# shift_dir ( args . path , args . uid , args . gid , args . nobody , dry_run = args . dry_run , verbose = args . verbose )