Home | History | Annotate | Download | only in test
      1 # Copyright 2017 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 """Obtain a lease file.
      6 
      7 This is used for testing leasing.
      8 """
      9 
     10 from __future__ import absolute_import
     11 from __future__ import division
     12 from __future__ import print_function
     13 
     14 import logging
     15 import sys
     16 
     17 from lucifer import loglib
     18 from lucifer import leasing
     19 
     20 logger = logging.getLogger(__name__)
     21 
     22 
     23 def main(args):
     24     """Main function
     25 
     26     @param args: list of command line args
     27     """
     28     loglib.configure_logging(name='obtain_lease')
     29     with leasing.obtain_lease(args[0]) as path:
     30         logger.debug('Obtained lease %s', path)
     31         print('done')
     32         raw_input()
     33         logger.debug('Finishing successfully')
     34     print('finish')
     35 
     36 
     37 if __name__ == '__main__':
     38     sys.exit(main(sys.argv[1:]))
     39