Exemplo n.º 1
0
 def setup_bootstrap(self,
                     metadata=None,
                     queryenv=None,
                     status_file_data=None,
                     mock_update=True,
                     mock_uninstall=False):
     upd = upd_api.UpdClientAPI()
     metadata.meta.return_value.user_data.return_value = self.USER_DATA.copy(
     )
     queryenv.QueryEnvService.return_value.get_latest_version.return_value = '2013-11-21'
     if mock_update:
         mock.patch.object(upd, 'update', mock.DEFAULT).start()
     if mock_uninstall:
         mock.patch.object(upd, 'uninstall', mock.DEFAULT).start()
     mock.patch.object(upd, 'get_system_id', return_value=SYSTEM_ID).start()
     if status_file_data:
         if not os.path.exists(os.path.dirname(STATUS_FILE)):
             os.makedirs(os.path.dirname(STATUS_FILE))
         with open(STATUS_FILE, 'w+') as fp:
             json.dump(status_file_data, fp)
     return upd
Exemplo n.º 2
0
 def __init__(self):
     super(UpdClient, self).__init__()
     self.optparser = optparse.OptionParser(option_list=(
         optparse.Option('-d',
                         '--daemonize',
                         action='store_true',
                         help='daemonize process'),
         optparse.Option('-P',
                         '--pid-file',
                         default=self.pid_file,
                         help='file to store PID in'),
         optparse.Option('-r', '--set-repository', help="[option removed]"),
         optparse.Option(
             '-l', '--log-file', default=self.log_file, help='log file'),
         optparse.Option('-v',
                         '--verbose',
                         action='store_true',
                         default=self.verbose,
                         help='verbose logging'),
         optparse.Option('--get-system-id',
                         action='store_true',
                         default=False,
                         help='print system-id and exit'),
         optparse.Option(
             '--make-status-file',
             action='store_true',
             default=False,
             help='make status file with current state and exit'),
         optparse.Option(
             '--downgrades-disabled',
             action='store_true',
             default=False,
             help=
             "works only with --make-status-file (introduced for migration to new update system"
         )))
     self.api = update_api.UpdClientAPI()
Exemplo n.º 3
0
 def onSIGHUP(self, *args):
     LOG.info('Reloading configuration')
     self.api = update_api.UpdClientAPI()
     self.api.bootstrap()