parameters: (self,
                                   service_name: str,
                                   get_cmd: str,
                                   get_set_cmd_dicts: Callable[[str], List[dict]])
docstring: A helper to set configs in the Dashboard.
  
          The method is useful for the pattern:
              - Getting a config from Dashboard by using a Dashboard command. e.g. current iSCSI
                gateways.
              - Parse or deserialize previous output. e.g. Dashboard command returns a JSON string.
              - Determine if the config need to be update. NOTE: This step is important because if a
                Dashboard command modified Ceph config, cephadm's config_notify() is called. Which
                kicks the serve() loop and the logic using this method is likely to be called again.
                A config should be updated only when needed.
              - Update a config in Dashboard by using a Dashboard command.
  
          :param service_name: the service name to be used for logging
          :type service_name: str
          :param get_cmd: Dashboard command prefix to get config. e.g. dashboard get-grafana-api-url
          :type get_cmd: str
          :param get_set_cmd_dicts: function to create a list, and each item is a command dictionary.
              e.g.
              [
                  {
                     'prefix': 'dashboard iscsi-gateway-add',
                     'service_url': 'http://admin:admin@aaa:5000',
                     'name': 'aaa'
                  },
                  {
                      'prefix': 'dashboard iscsi-gateway-add',
                      'service_url': 'http://admin:admin@bbb:5000',
                      'name': 'bbb'
                  }
              ]
              The function should return empty list if no command need to be sent.
          :type get_set_cmd_dicts: Callable[[str], List[dict]]
docstring_summary: A helper to set configs in the Dashboard.
docstring_tokens: A helper to set configs in the Dashboard .
function: def _check_and_set_dashboard(self,
                                   service_name: str,
                                   get_cmd: str,
                                   get_set_cmd_dicts: Callable[[str], List[dict]]) -> None:
          """A helper to set configs in the Dashboard.
  
          The method is useful for the pattern:
              - Getting a config from Dashboard by using a Dashboard command. e.g. current iSCSI
                gateways.
              - Parse or deserialize previous output. e.g. Dashboard command returns a JSON string.
              - Determine if the config need to be update. NOTE: This step is important because if a
                Dashboard command modified Ceph config, cephadm's config_notify() is called. Which
                kicks the serve() loop and the logic using this method is likely to be called again.
                A config should be updated only when needed.
              - Update a config in Dashboard by using a Dashboard command.
  
          :param service_name: the service name to be used for logging
          :type service_name: str
          :param get_cmd: Dashboard command prefix to get config. e.g. dashboard get-grafana-api-url
          :type get_cmd: str
          :param get_set_cmd_dicts: function to create a list, and each item is a command dictionary.
              e.g.
              [
                  {
                     'prefix': 'dashboard iscsi-gateway-add',
                     'service_url': 'http://admin:admin@aaa:5000',
                     'name': 'aaa'
                  },
                  {
                      'prefix': 'dashboard iscsi-gateway-add',
                      'service_url': 'http://admin:admin@bbb:5000',
                      'name': 'bbb'
                  }
              ]
              The function should return empty list if no command need to be sent.
          :type get_set_cmd_dicts: Callable[[str], List[dict]]
          """
  
          try:
              _, out, _ = self.mgr.check_mon_command({
                  'prefix': get_cmd
              })
          except MonCommandFailed as e:
              logger.warning('Failed to get Dashboard config for %s: %s', service_name, e)
              return
          cmd_dicts = get_set_cmd_dicts(out.strip())
          for cmd_dict in list(cmd_dicts):
              try:
                  inbuf = cmd_dict.pop('inbuf', None)
                  _, out, _ = self.mgr.check_mon_command(cmd_dict, inbuf)
              except MonCommandFailed as e:
                  logger.warning('Failed to set Dashboard config for %s: %s', service_name, e)
function_tokens: def _check_and_set_dashboard ( self , service_name : str , get_cmd : str , get_set_cmd_dicts : Callable [ [ str ] , List [ dict ] ] ) -> None : try : _ , out , _ = self . mgr . check_mon_command ( { 'prefix' : get_cmd } ) except MonCommandFailed as e : logger . warning ( 'Failed to get Dashboard config for %s: %s' , service_name , e ) return cmd_dicts = get_set_cmd_dicts ( out . strip ( ) ) for cmd_dict in list ( cmd_dicts ) : try : inbuf = cmd_dict . pop ( 'inbuf' , None ) _ , out , _ = self . mgr . check_mon_command ( cmd_dict , inbuf ) except MonCommandFailed as e : logger . warning ( 'Failed to set Dashboard config for %s: %s' , service_name , e )