IcsMeta Common Library

IcsMeta: Library for Meta

This is the IcsMeta common library.
class opslib.icsmeta.IcsMeta[source]
__dict__ = <dictproxy object at 0x4b013d0>
__init__()[source]

Initialize Ics Meta (meta-data, user-data, credentials, tags)

__module__ = 'opslib.icsmeta'
__weakref__

list of weak references to the object (if defined)

download_cfg(pattern)[source]

Download configuration files from S3

Parameters:pattern (string) – regrex expression to match
Return type:string
Returns:the local path where downloaded files stored
download_script(pattern)[source]

Download scripts from S3

Parameters:pattern (string) – regrex expression to match
Return type:string
Returns:the local path where downloaded files stored
generate_hostname()[source]

Generate the hostname

Return type:string
Returns:the hostname
get_cfg_bucket()[source]

Get the Config Bucket from instance user-data

Return type:string
Returns:the Config Bucket name
get_credentials()[source]

Get AWS credentials from instance user-data

Return type:dict
Returns:AWS credentials as a dictionary
get_dns_from_tag()[source]

Get the DnsName from instance tags

Return type:string
Returns:the DnsName
get_eips_from_tag()[source]

Get the EIP list from instance tags

Return type:list
Returns:the list contains EIP addresses
get_instance_id()[source]

Get the instance id from instance meta-data

Return type:string
Returns:the instance id
get_instance_name()[source]

Get the Instance name from instance tags

Return type:string
Returns:the Instance name
get_machine_tags(timeout=120)[source]

Get the instance tags

Return type:string
Returns:the tags of this instance
static get_meta_data(timeout=None, url=None, num_retries=None)[source]

Get instance meta data

Parameters:
  • timeout (int) – timeout for the request
  • url (string) – metadata_service_url
  • num_retries (int) – how many times to retry
Return type:

dict

Returns:

instance meta data as a dictionary

get_openssh_pubkey()[source]

Get the openssh public key from instance meta-data

Return type:string
Returns:the contents of openssh public key
get_private_ip()[source]

Get the private ip address from instance meta-data

Return type:string
Returns:the private ip address
get_public_hostname()[source]

Get the public hostname from instance meta-data

Return type:string
Returns:the public hostname
get_public_ip()[source]

Get the public ip address from instance meta-data

Return type:string
Returns:the public ip address
get_region()[source]

Get the region from instance meta-data

Return type:string
Returns:the region name
get_role_name()[source]

Get the Role name from instance tags

Return type:string
Returns:the Role name
get_script_url()[source]

Get the S3 url for import scripts from instance user-data

Return type:string
Returns:the s3 url for scripts
get_sns_topic()[source]

Get the SNS Topic from instance user-data

Return type:string
Returns:the SNS Topic name
static get_user_data(timeout=None, url=None, num_retries=None)[source]

Get instance user data

Parameters:
  • timeout (int) – timeout for the request
  • url (string) – metadata_service_url
  • num_retries (int) – how many times to retry
Return type:

dict

Returns:

instance user data as a dictionary

get_zone()[source]

Get the availability zone from instance meta-data

Return type:string
Returns:the availability zone name
init_alert(prefix='ICS')[source]

Intialize ICS Alert

Parameters:prefix (str) – prefix string to indicate which process
Return type:class
Returns:the instance of initialized IcsAlert class
init_config()[source]

Combine meta-data, user-data, tags into one json string

Return type:dict
Returns:json string contains meta-data, user-data, tags
is_eip_ready(eip)[source]

check the readiness of the specified EIP address

Parameters:eip (string) – one EIP address
Return type:boolean
Returns:True/False

Indices and tables

Table Of Contents

Previous topic

IcsR53 Common Library

Next topic

IcsLog Common Library

This Page