Get the value of the enable-oslogin metadata key.

    Args:
      metadata_dict: json, the deserialized contents of the metadata server.

    Returns:
      bool, True if OS Login is enabled for VM access.
13301
def _GetEnableOsLoginValue(self, metadata_dict):
    
    instance_data, project_data = self._GetInstanceAndProjectAttributes(
        metadata_dict)
    instance_value = instance_data.get('enable-oslogin')
    project_value = project_data.get('enable-oslogin')
    value = instance_value or project_value or ''

    return value.lower() == 'true'
247326
function (metadata) {
    if (typeof metadata === 'string') {
        return getJsonPropertyDecorator({ name: metadata, required: false, access: exports.AccessType.BOTH });
    }
    else {
        return getJsonPropertyDecorator(metadata);
    }
}
624337
def GetUcsPropertyMeta(classId, key):
		
		if classId in _ManagedObjectMeta:
			if key in _ManagedObjectMeta[classId]:
				return _ManagedObjectMeta[classId][key]
		return None
1062872
def on_gcloud_vm():
    
    r = None
    try:
        r = requests.get('http://metadata.google.internal')
    except requests.ConnectionError:
        return False

    try:
        if r.headers['Metadata-Flavor'] == 'Google' and \
           r.headers['Server'] == 'Metadata Server for VM':
            return True
    except KeyError:
        return False
538073
def metadata(self):
        
        resp = self.r_session.get(self.server_url)
        resp.raise_for_status()
        return response_to_json_dict(resp)
331445
def metadata_with_correct_capability(metadata)
      capability = self.class::CAPABILITY
      raise ArgumentError, "Missing constant #{self.class}::CAPABILITY" unless capability
      return Metadata.new(capability: capability) unless metadata
      raise ArgumentError, ":metadata argument <#{metadata}> does not appear to be metadata" unless metadata.respond_to?(:capability)
      raise ArgumentError, "Wrong capability for #{self.class.name} metadata; expected '#{capability}', was '#{metadata.capability}'" unless metadata.capability == capability
      metadata
    end
1361358
def metadata_index_json(self):
        """"""
        try:
            return op.join(self.metadata_dir, 'INDEX.json')
        except FileNotFoundError:
            return op.join(self.metadata_dir, 'INDEX_JSON')
1229563
def meta_get(self, key, metafield, default=None):
        '''  '''
        return self._meta.get(key, {}).get(metafield, default)
1259149
def awsReadMetadataKey():
  """"""
  parser = argparse.ArgumentParser()

  parser.add_argument("--key",
                      dest="keyname",
                      help="Which metadata key to read")

  cli = parser.parse_args()

  print getMetadataKey(name=cli.keyname)
287873
def extract_http_metadata(wrapped, instance, args, kwargs, return_value):
    
    response = return_value
    LOGGER.debug(
        'Extracting HTTP metadata',
        args=args,
        kwargs=kwargs,
    )
    if 'request' in kwargs:
        request = kwargs['request']
    else:
        request = args[0]

    metadata = {
        'http': {
            'request': {
                'method': request.method.upper(),
                'url': request.url,
            },
        },
    }
    if response is not None:
        metadata['http']['response'] = {
            'status': response.status_code,
        }

    return metadata
881148
def get_region_from_metadata():
    '''
    
    '''
    global __Location__

    if __Location__ == 'do-not-get-from-metadata':
        log.debug('Previously failed to get AWS region from metadata. Not trying again.')
        return None

    # Cached region
    if __Location__ != '':
        return __Location__

    try:
        # Connections to instance meta-data must fail fast and never be proxied
        result = requests.get(
            "http://169.254.169.254/latest/dynamic/instance-identity/document",
            proxies={'http': ''}, timeout=AWS_METADATA_TIMEOUT,
        )
    except requests.exceptions.RequestException:
        log.warning('Failed to get AWS region from instance metadata.', exc_info=True)
        # Do not try again
        __Location__ = 'do-not-get-from-metadata'
        return None

    try:
        region = result.json()['region']
        __Location__ = region
        return __Location__
    except (ValueError, KeyError):
        log.warning('Failed to decode JSON from instance metadata.')
        return None

    return None
235439
def validate_metadata(self, metadata):
        
        response = self.requests_session.post(
            f'{self.url}/validate',
            data=json.dumps(metadata),
            headers=self._headers
        )
        if response.content == b'true\n':
            return True
        else:
            logger.info(self._parse_search_response(response.content))
            return False
232255
def encode_metadata(self):
        
        encoded_list = []
        for key, value in iteritems(self.metadata):
            key_str = str(key)  # dict keys may be of any object type.

            # confirm that the key does not contain unwanted characters.
            if re.search(r'^$|[\s,]+', key_str):
                msg = 'Upload-metadata key "{}" cannot be empty nor contain spaces or commas.'
                raise ValueError(msg.format(key_str))

            value_bytes = b(value)  # python 3 only encodes bytes
            encoded_list.append('{} {}'.format(key_str, b64encode(value_bytes).decode('ascii')))
        return encoded_list
372046
def read_metadata(self, key):
        
        if getattr(getattr(self.group, 'meta', None), key, None) is not None:
            return self.parent.select(self._get_metadata_path(key))
        return None
188034
def encryption_metadata_exists(md):
        # type: (dict) -> bool
        
        try:
            if blobxfer.util.is_not_empty(
                    md[EncryptionMetadata._METADATA_KEY_NAME]):
                return True
        except (KeyError, TypeError):
            pass
        return False
148346
def get_metadata_path(name):
    """"""
    return pkg_resources.resource_filename('voobly', os.path.join(METADATA_PATH, '{}.json'.format(name)))
70868
def get_profile_name(org_vm, profile_inst):
    
    try:
        org = org_vm.tovalues(profile_inst['RegisteredOrganization'])
        name = profile_inst['RegisteredName']
        vers = profile_inst['RegisteredVersion']
        return org, name, vers

    except TypeError as te:
        print('ORG_VM.TOVALUES FAILED. inst=%s, Exception %s' %
              (profile_inst, te))
    except ValueError as ve:
        print('ORG_VM.TOVALUES FAILED. inst=%s, Exception %s' %
              (profile_inst, ve))
    return 'ERR', 'ERR', 'ERR'