parameters: (self, selected_target)
return_statement: return False, ""
docstring: Checking selected target validity
docstring_summary: Checking selected target validity
docstring_tokens: Checking selected target validity
function: def check_target(self, selected_target):
          """ Checking selected target validity
          """
          ticket = None
          status = None
          info_message = None
          got_signal = False
          while True:
              Logger().info(u"Begin check_target ticket = %s..." % ticket)
              previous_status = status
              previous_info_message = info_message
              status, infos = self.engine.check_target(selected_target,
                                                       self.pid,
                                                       ticket)
              ticket = None
              info_message = infos.get('message')
              refresh_page = (got_signal
                              or (status != previous_status)
                              or (previous_info_message != info_message)
                              or (status == APPROVAL_NONE))
              Logger().info(u"End check_target ... refresh : %s" % refresh_page)
  #            if refresh_page:
  #                self.send_data({u'forcemodule': True})
              if refresh_page:
                  self.send_data({u'module': u'transitory'})
  
              if status == APPROVAL_ACCEPTED:
                  return True, ""
              if refresh_page:
                  self.interactive_display_waitinfo(status, infos)
              got_signal = False
              r = []
              try:
                  Logger().info(u"Start Select ...")
                  logtimer.pause()
                  if status == APPROVAL_PENDING:
                      # waiting for status update
                      r, w, x = select([self.proxy_conx], [], [],
                                       WORKFLOW_POLL_INTERVAL)
                  else:
                      r = self.wait_read_proxy_conx()
                  logtimer.resume()
              except BastionSignal as e:
                  Logger().info("Got Signal %s" % e)
                  got_signal = True
              except Exception as e:
                  logtimer.resume()
                  if DEBUG:
                      Logger().info("exception: '%s'" % e)
                      import traceback
                      Logger().info("<<<<%s>>>>" % traceback.format_exc())
                  raise
              if self.proxy_conx in r:
                  _status, _error = self.receive_data(blocking_call=False)
                  if self.shared.get(u'waitinforeturn') == "backselector":
                      # received back to selector
                      self.send_data({
                          u'module': u'selector', u'target_login': '',
                          u'target_device': ''
                      })
                      return None, ""
                  if self.shared.get(u'waitinforeturn') == "exit":
                      # received exit
                      self.send_data({u'module': u'close'})
                      return False, ""
                  if self.shared.get(u'waitinforeturn') == "confirm":
                      # should parse the ticket info
                      desc = self.shared.get(u'comment')
                      ticketno = self.shared.get(u'ticket')
                      duration = self.parse_duration(
                          self.shared.get(u'duration')
                      )
                      ticket = {u"description": desc if desc else None,
                                u"ticket": ticketno if ticketno else None,
                                u"duration": duration}
          return False, ""
function_tokens: def check_target ( self , selected_target ) : ticket = None status = None info_message = None got_signal = False while True : Logger ( ) . info ( u"Begin check_target ticket = %s..." % ticket ) previous_status = status previous_info_message = info_message status , infos = self . engine . check_target ( selected_target , self . pid , ticket ) ticket = None info_message = infos . get ( 'message' ) refresh_page = ( got_signal or ( status != previous_status ) or ( previous_info_message != info_message ) or ( status == APPROVAL_NONE ) ) Logger ( ) . info ( u"End check_target ... refresh : %s" % refresh_page ) #            if refresh_page: #                self.send_data({u'forcemodule': True}) if refresh_page : self . send_data ( { u'module' : u'transitory' } ) if status == APPROVAL_ACCEPTED : return True , "" if refresh_page : self . interactive_display_waitinfo ( status , infos ) got_signal = False r = [ ] try : Logger ( ) . info ( u"Start Select ..." ) logtimer . pause ( ) if status == APPROVAL_PENDING : # waiting for status update r , w , x = select ( [ self . proxy_conx ] , [ ] , [ ] , WORKFLOW_POLL_INTERVAL ) else : r = self . wait_read_proxy_conx ( ) logtimer . resume ( ) except BastionSignal as e : Logger ( ) . info ( "Got Signal %s" % e ) got_signal = True except Exception as e : logtimer . resume ( ) if DEBUG : Logger ( ) . info ( "exception: '%s'" % e ) import traceback Logger ( ) . info ( "<<<<%s>>>>" % traceback . format_exc ( ) ) raise if self . proxy_conx in r : _status , _error = self . receive_data ( blocking_call = False ) if self . shared . get ( u'waitinforeturn' ) == "backselector" : # received back to selector self . send_data ( { u'module' : u'selector' , u'target_login' : '' , u'target_device' : '' } ) return None , "" if self . shared . get ( u'waitinforeturn' ) == "exit" : # received exit self . send_data ( { u'module' : u'close' } ) return False , "" if self . shared . get ( u'waitinforeturn' ) == "confirm" : # should parse the ticket info desc = self . shared . get ( u'comment' ) ticketno = self . shared . get ( u'ticket' ) duration = self . parse_duration ( self . shared . get ( u'duration' ) ) ticket = { u"description" : desc if desc else None , u"ticket" : ticketno if ticketno else None , u"duration" : duration } return False , ""