Add a capability of the RETS board
        :param name: The name of the capability
        :param uri: The capability URI given by the RETS board
        :return: None
428416
def add_capability(self, name, uri):
        

        parse_results = urlparse(uri)
        if parse_results.hostname is None:
            # relative URL given, so build this into an absolute URL
            login_url = self.capabilities.get('Login')
            if not login_url:
                logger.error("There is no login URL stored, so additional capabilities cannot be added.")
                raise ValueError("Cannot automatically determine absolute path for {0!s} given.".format(uri))

            parts = urlparse(login_url)
            port = ':{}'.format(parts.port) if parts.port else ''
            uri = parts.scheme + '://' + parts.hostname + port + '/' + uri.lstrip('/')

        self.capabilities[name] = uri
410540
def add_permission(self, name):
        
        perm = self.find_permission(name)
        if perm is None:
            try:
                perm = self.permission_model()
                perm.name = name
                self.get_session.add(perm)
                self.get_session.commit()
                return perm
            except Exception as e:
                log.error(c.LOGMSG_ERR_SEC_ADD_PERMISSION.format(str(e)))
                self.get_session.rollback()
        return perm
879051
def _add_capabilities_from_properties(self, capabilities, section):
        
        cap_type = {'Capabilities': 'server', 'AppiumCapabilities': 'Appium server'}
        try:
            for cap, cap_value in dict(self.config.items(section)).items():
                self.logger.debug("Added %s capability: %s = %s", cap_type[section], cap, cap_value)
                capabilities[cap] = cap_value if cap == 'version' else self._convert_property_type(cap_value)
        except NoSectionError:
            pass
761825
def _set_remote(self, name, url):
        
        remotes = self._get_remotes()
        exising_url = remotes.get(name)
        if exising_url == url:
            logger.info('Remote already exists %s <%s>', name, url)
            return
        if not exising_url:
            logger.info('Adding remote %s <%s>', name, url)
            self.log_call(['git', 'remote', 'add', name, url], cwd=self.cwd)
        else:
            logger.info('Remote remote %s <%s> -> <%s>',
                        name, exising_url, url)
            self.log_call(['git', 'remote', 'rm', name], cwd=self.cwd)
            self.log_call(['git', 'remote', 'add', name, url], cwd=self.cwd)
306812
def explore_uri(self, explorer_resource, show_back=True):
        
        uri = explorer_resource.uri
        caps = explorer_resource.acceptable_capabilities
        checks = explorer_resource.checks
        print("Reading %s" % (uri))
        options = {}
        capability = None
        try:
            if (caps == 'resource'):
                # Not expecting a capability document
                self.explore_show_head(uri, check_headers=checks)
            else:
                s = Sitemap()
                list = s.parse_xml(url_or_file_open(uri))
                (options, capability) = self.explore_show_summary(
                    list, s.parsed_index, caps, context=uri)
        except IOError as e:
            print("Cannot read %s (%s)" % (uri, str(e)))
        except Exception as e:
            print("Cannot parse %s (%s)" % (uri, str(e)))
        #
        # Loop until we have some valid input
        #
        while (True):
            # don't offer number option for no resources/capabilities
            num_prompt = '' if (len(options) == 0) else 'number, '
            up_prompt = 'b(ack), ' if (show_back) else ''
            if (self.fake_input):
                inp = self.fake_input
            else:
                inp = input("Follow [%s%sq(uit)]?" % (num_prompt, up_prompt))
            if (inp in options.keys()):
                break
            if (inp == 'q'):
                raise ExplorerQuit()
            if (inp == 'b'):
                return(None)
        #
        # Got input that is one of the options
        #
        checks = {}
        r = options[inp]
        if (r.capability is None):
            if (capability in ['resourcelist', 'changelist',
                               'resourcedump', 'changedump']):
                caps = 'resource'
            else:
                caps = self.allowed_entries(capability)
        elif (r.capability is 'resource'):
            caps = r.capability
        else:
            caps = [r.capability]
        # Record anything we know about the resource to check
        if (r.length is not None):
            checks['content-length'] = r.length
        if (r.lastmod is not None):
            checks['last-modified'] = r.lastmod
        if (r.mime_type is not None):
            checks['content-type'] = r.mime_type
        # FIXME - could add fixity checks here too
        return(XResource(r.uri, caps, checks))
247141
def __set_ethernet_uris(self, ethernet_names, operation="add"):
        """"""
        if not isinstance(ethernet_names, list):
            ethernet_names = [ethernet_names]

        associated_enets = self.data.get('networkUris', [])
        ethernet_uris = []

        for i, enet in enumerate(ethernet_names):
            enet_exists = self._ethernet_networks.get_by_name(enet)
            if enet_exists:
                ethernet_uris.append(enet_exists.data['uri'])
            else:
                raise HPOneViewResourceNotFound("Ethernet: {} does not exist".foramt(enet))

        if operation == "remove":
            enets_to_update = sorted(list(set(associated_enets) - set(ethernet_uris)))
        elif operation == "add":
            enets_to_update = sorted(list(set(associated_enets).union(set(ethernet_uris))))
        else:
            raise ValueError("Value {} is not supported as operation. The supported values are: ['add', 'remove']")

        if set(enets_to_update) != set(associated_enets):
            updated_network = {'networkUris': enets_to_update}
            self.update(updated_network)
250985
public void addPermission(String roleName, String capability) {
    Permission permission = new Permission();
    permission.setRoleName(roleName);
    permission.setCapability(capability);
    this.permissions.add(permission);
  }
726469
def add_connection(uri) #:nodoc:
      publisher = SlaveProxy.new(@caller_id, uri)
      begin
        protocol, host, port = publisher.request_topic(@topic_name, [["TCPROS"]])
        if protocol == "TCPROS"
          connection = TCPROS::Client.new(host, port, @caller_id, @topic_name, @topic_type, uri, @tcp_no_delay)
          connection.start
        else
          puts "not support protocol: #{protocol}"
          raise "not support protocol: #{protocol}"
        end
        connection.id = "#{@topic_name}_in_#{@connection_id_number}"
        @connection_id_number += 1
        @connections.push(connection)
        return connection
      rescue
#	puts "request to #{uri} fail"
        return false
      end
    end
1181965
def capability(cap_name, *args)
      cap_mod = capability_module(cap_name.to_sym)
      if !cap_mod
        raise Errors::CapabilityNotFound,
          cap:  cap_name.to_s,
          host: @cap_host_chain[0][0].to_s
      end

      cap_method = nil
      begin
        cap_method = cap_mod.method(cap_name)
      rescue NameError
        raise Errors::CapabilityInvalid,
          cap: cap_name.to_s,
          host: @cap_host_chain[0][0].to_s
      end

      args = @cap_args + args
      @cap_logger.info(
        "Execute capability: #{cap_name} #{args.inspect} (#{@cap_host_chain[0][0]})")
      cap_method.call(*args)
    end
748649
def add_users_to(uri, username=nil, password=nil)
      begin
        uri = URI.parse(uri) if uri.instance_of?(String)
        if username
          userinfo = URI.escape(username, USERPW)
          userinfo += ":" + URI.escape(password, USERPW) unless password.nil?
          uri.userinfo = userinfo
        end
        uri
      rescue URI::InvalidURIError
        if uri =~ PATTERN::GIT_URI
          user, host, path = $1, $2, $3
          userinfo = URI.escape(user, USERPW)
          userinfo += ":" + URI.escape(username, USERPW) unless username.nil?
          path = "/" + path unless path.start_with?('/')
          URI::Generic::build({:scheme => "ssh",
                              :userinfo => userinfo,
                              :host => host,
                              :path => path
          })
        else
          raise
        end
      end
    end
566519
def add_reference(self, subj: Node, val: str) -> None:
        
        match = FHIR_RESOURCE_RE.match(val)
        ref_uri_str = res_type = None
        if match:
            ref_uri_str = val if match.group(FHIR_RE_BASE) else (self._base_uri + urllib.parse.quote(val))
            res_type = match.group(FHIR_RE_RESOURCE)
        elif '://' in val:
            ref_uri_str = val
            res_type = "Resource"
        elif self._base_uri and not val.startswith('#') and not val.startswith('/'):
            ref_uri_str = self._base_uri + urllib.parse.quote(val)
            res_type = val.split('/', 1)[0] if '/' in val else "Resource"
        if ref_uri_str:
            ref_uri = URIRef(ref_uri_str)
            self.add(subj, FHIR.link, ref_uri)
            self.add(ref_uri, RDF.type, FHIR[res_type])
1350152
def capability_info(self, name=None):
        
        for r in self.resources:
            if (r.capability == name):
                return(r)
        return(None)
740179
def service(name, action):
    
    if action == 'open':
        subprocess.check_output(['ufw', 'allow', str(name)],
                                universal_newlines=True)
    elif action == 'close':
        subprocess.check_output(['ufw', 'delete', 'allow', str(name)],
                                universal_newlines=True)
    else:
        raise UFWError(("'{}' not supported, use 'allow' "
                        "or 'delete'").format(action))
1172979
def enabled(name):
    '''
    
    '''
    ret = {'name': name,
           'result': True,
           'changes': {},
           'comment': ''}

    stat = __salt__['rdp.status']()

    if not stat:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'RDP will be enabled'
            return ret

        ret['result'] = __salt__['rdp.enable']()
        ret['changes'] = {'RDP was enabled': True}
        return ret

    ret['comment'] = 'RDP is enabled'
    return ret
1369378
def access_add(name, event, cid, uid, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('access:add', **{
        'unicorn': ctx.repo.create_secure_service('unicorn'),
        'service': name,
        'event': event,
        'cids': cid,
        'uids': uid,
    })
765590
def enable(name, **kwargs):
    '''
    
    '''
    osmajor = _osrel()[0]
    if osmajor < '6':
        cmd = 'update-rc.d -f {0} defaults 99'.format(_cmd_quote(name))
    else:
        cmd = 'update-rc.d {0} enable'.format(_cmd_quote(name))
    try:
        if int(osmajor) >= 6:
            cmd = 'insserv {0} && '.format(_cmd_quote(name)) + cmd
    except ValueError:
        osrel = _osrel()
        if osrel == 'testing/unstable' or osrel == 'unstable' or osrel.endswith("/sid"):
            cmd = 'insserv {0} && '.format(_cmd_quote(name)) + cmd
    return not __salt__['cmd.retcode'](cmd, python_shell=True)
1025041
private String addTenantParam(String uri) {
        if (m_credentials != null && m_credentials.getTenant() != null) {
            if (uri.indexOf("?") > 0) {
                return uri + "&tenant=" + m_credentials.getTenant();
            } else {
                return uri + "?tenant=" + m_credentials.getTenant();
            }
        }
        return uri;
    }