Last active
August 29, 2015 14:15
-
-
Save ryancurrah/4c333e4835d2cff46501 to your computer and use it in GitHub Desktop.
Printing Cloudify CTX object attributes using dir.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CTX Instance | |
print type(ctx.instance) | |
<class 'cloudify.context.NodeInstanceContext'> | |
print dir(ctx.instance) | |
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_context', '_endpoint', '_get_node_instance_if_needed', '_get_node_instance_ip_if_needed', '_host_ip', '_modifiable', '_node', '_node_instance', '_relationships', 'host_ip', 'id', 'relationships', 'runtime_properties', 'update'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CTX Instance Relationships | |
print type(ctx.instance.relationships) | |
<type 'list'> | |
print dir(ctx.instance.relationships) | |
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] | |
print ctx.instance.relationships | |
[<cloudify.context.RelationshipContext object at 0x18b8d90>] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CTX Instance Runtime Properties | |
print type(ctx.instance.runtime_properties) | |
<class 'cloudify.manager.DirtyTrackingDict'> | |
print dir(ctx.instance.runtime_properties) | |
print ctx.instance.runtime_properties | |
{u'build_id': u'd86a3f86-b97f-11e4-8975-fa163e7795b7', u'dmgr_soap_port': 1000, u'dmgr_host_name': u'dmgr-vm-58d.eng.cloud.com'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CTX Node Properties | |
print type(ctx.node.properties) | |
<class 'cloudify.context.ImmutableProperties'> | |
print ctx.node.properties | |
{u'wasnd_version': 855, u'plg_fixpack': 4, u'ihs_fixpack': 4, u'nd_fixpack': 4, u'cloudify_runtime': {}, u'cell_name': u'ryantest'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CTX Node | |
print type(ctx.node) | |
<class 'cloudify.context.NodeContext'> | |
print dir(ctx.node) | |
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_context', '_endpoint', '_get_node_if_needed', '_node', 'id', 'name', 'properties'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Main CTX object | |
print type(ctx) | |
<class 'proxy_tools.Proxy'> | |
print dir(ctx) | |
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_bootstrap_context', '_capabilities', '_context', '_endpoint', '_host_ip', '_init_cloudify_logger', '_instance', '_local', '_logger', '_node', '_provider_context', '_return_value', '_source', '_target', '_verify_in_node_context', '_verify_in_node_or_relationship_context', '_verify_in_relationship_context', 'blueprint', 'bootstrap_context', 'capabilities', 'deployment', 'download_resource', 'execution_id', 'get_resource', 'instance', 'logger', 'node', 'operation', 'plugin', 'provider_context', 'returns', 'send_event', 'source', 'target', 'task_id', 'task_name', 'task_target', 'type', 'workflow_id'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Used in Relationship Instances | |
print type(ctx.source) | |
<class 'cloudify.context.RelationshipSubjectContext'> | |
print dir(ctx.source) | |
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_context', 'instance', 'node'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CTX Relationship Instances | |
print type(ctx.target) | |
<class 'cloudify.context.RelationshipSubjectContext'> | |
print dir(ctx.target) | |
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_context', 'instance', 'node'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment