IcsMeta Common Library

IcsMeta: Library for Meta

This is the IcsMeta common library.
class opslib.icsmeta.IcsMeta[source]
__dict__ = dict_proxy({'get_role_name': <function get_role_name at 0x568d848>, 'init_alert': <function init_alert at 0x568db90>, 'get_private_ip': <function get_private_ip at 0x568d398>, 'get_user_data': <staticmethod object at 0x568b050>, 'get_script_url': <function get_script_url at 0x568d578>, '__module__': 'opslib.icsmeta', 'get_instance_name': <function get_instance_name at 0x568d8c0>, 'generate_hostname': <function generate_hostname at 0x568d938>, 'get_public_hostname': <function get_public_hostname at 0x568d410>, '__doc__': None, 'get_meta_data': <staticmethod object at 0x5679638>, '__dict__': <attribute '__dict__' of 'IcsMeta' objects>, 'download_script': <function download_script at 0x568da28>, 'get_dns_from_tag': <function get_dns_from_tag at 0x568d7d0>, '__weakref__': <attribute '__weakref__' of 'IcsMeta' objects>, 'get_instance_id': <function get_instance_id at 0x568d5f0>, '__init__': <function __init__ at 0x568d050>, 'get_region': <function get_region at 0x568d230>, 'get_eips_from_tag': <function get_eips_from_tag at 0x568d758>, 'get_public_ip': <function get_public_ip at 0x568d320>, 'init_config': <function init_config at 0x568db18>, 'get_cfg_bucket': <function get_cfg_bucket at 0x568d500>, 'download_cfg': <function download_cfg at 0x568daa0>, 'get_credentials': <function get_credentials at 0x568d1b8>, 'get_openssh_pubkey': <function get_openssh_pubkey at 0x568d668>, 'is_eip_ready': <function is_eip_ready at 0x568d9b0>, 'get_zone': <function get_zone at 0x568d2a8>, 'get_sns_topic': <function get_sns_topic at 0x568d488>, 'get_machine_tags': <function get_machine_tags at 0x568d6e0>})
__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

Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.