Module Expr Str Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore BinOpAdd BinOpAdd BinOpAdd Call NameLoad Str Call AttributeLoad Call NameLoad Call NameLoad Str attr Str Call NameLoad Str Call AttributeLoad Call NameLoad Call NameLoad Str attr Str Assign NameStore ListLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str If NameLoad body For NameStore NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword NameLoad keyword NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str If NameLoad body For NameStore NameLoad body For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str ListLoad Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr keyword Str If NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword SubscriptLoad NameLoad Index AttributeLoad NameLoad attr If CompareEq SubscriptLoad NameLoad Index AttributeLoad NameLoad attr Str body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str ListLoad Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If NameLoad body If CompareIn Str SubscriptLoad NameLoad Index AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If CompareIn Str SubscriptLoad NameLoad Index AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If CompareIn AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr AttributeLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num attr orelse Assign AttributeStore NameLoad attr AttributeLoad SubscriptLoad NameLoad Index Num attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr keyword NameLoad keyword AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword Str keyword Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If CompareEq Call NameLoad NameLoad Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr Str orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str decorator_list decorator_list
N/A N/A 
  This class performs a few functions:
  1. If the host is up and the container is down it starts the container
  2. Verifies a container is running
  3. Verifies a container has cron running.  Calls start.sh if needed.

 N/A paramiko N/A salt.client N/A time circularlist CircularList etcd Etcd paramiko SSHException pyparsing Literal srange Word VerifyFormations N/A object N/A __init__ N/A N/A self manager logger N/A N/A N/A N/A self logger logger N/A N/A self salt_client N/A N/A N/A salt client LocalClient N/A N/A self manager manager N/A N/A self etcd N/A Etcd logger N/A start_verifying N/A N/A self N/A N/A N/A formation_parser N/A N/A N/A N/A Literal /formations/ N/A N/A N/A Word N/A srange [0-9a-zA-Z_-] setResultsName username N/A Literal / N/A N/A N/A Word N/A srange [0-9a-zA-Z_-] setResultsName formation_name N/A formation_list N/A N/A user_list N/A N/A N/A self etcd list_directory formations N/A user_list N/A N/A user user_list N/A N/A formations N/A N/A N/A self etcd list_directory user N/A formation formations N/A N/A parse_results N/A N/A formation_parser parseString formation N/A parse_results N/A N/A formation_name N/A parse_results N/A formation_name N/A username N/A parse_results N/A username N/A N/A N/A N/A self logger info N/A N/A Attempting to load formation: {formation_name} with username: {username} format formation_name formation_name username username N/A f N/A N/A N/A self manager load_formation_from_etcd username formation_name N/A N/A N/A formation_list append f N/A N/A N/A N/A N/A self logger error Could not parse the ETCD string N/A formation_list N/A N/A f formation_list N/A N/A app N/A f application_list N/A N/A N/A N/A N/A self logger info N/A N/A Running verification on app: {app_name} format app_name N/A app hostname N/A N/A N/A N/A self logger info N/A N/A {server} docker ps | grep {container_id} format server N/A app host_server container_id N/A app container_id N/A results N/A N/A N/A self salt_client cmd N/A app host_server cmd.run N/A N/A N/A docker ps | grep {container_id} format container_id N/A app container_id expr_form list N/A results N/A N/A N/A N/A N/A self logger debug N/A N/A Salt return: {docker_results} format docker_results N/A results N/A N/A app host_server N/A N/A N/A results N/A N/A app host_server N/A N/A N/A N/A N/A self logger error N/A N/A App {app} is not running! format app N/A app hostname N/A N/A N/A self start_application app N/A N/A N/A N/A N/A self logger info N/A N/A App {app} is running.  Checking if cron is running also format app N/A app hostname N/A N/A N/A N/A self logger info Sleeping 2 seconds while the container starts N/A N/A N/A time sleep 2 N/A N/A N/A self check_running_application app N/A N/A N/A N/A N/A self logger error N/A N/A Call out to server {server} failed. Moving it format server N/A app host_server N/A N/A N/A self move_application app N/A start_application N/A N/A self app N/A N/A N/A N/A N/A N/A self logger info N/A N/A Starting app {app} with docker id: {app_id} up format app N/A app hostname app_id N/A app container_id N/A results N/A N/A N/A self salt_client cmd N/A app host_server cmd.run N/A N/A N/A docker start {container_id} format container_id N/A app container_id expr_form list N/A N/A N/A N/A self logger debug results N/A results N/A N/A N/A Error: No such container N/A results N/A N/A app host_server N/A N/A N/A N/A N/A self logger error Container is missing on the host!. Trying to recreate N/A N/A N/A N/A self manager start_application app N/A N/A N/A N/A self logger info Sleeping 2 seconds while the container starts N/A N/A N/A time sleep 2 N/A N/A N/A N/A self manager bootstrap_application app N/A N/A N/A Error: start: No such container: N/A results N/A N/A app host_server N/A N/A N/A N/A N/A self logger error Container failed to start N/A N/A N/A self move_application app N/A N/A N/A N/A N/A self logger info Waiting 2 seconds for docker to start the container N/A N/A N/A time sleep 2 N/A N/A N/A self check_running_application app N/A N/A N/A N/A N/A self logger error N/A N/A Failed to start {container_id} on host {host} format container_id N/A app container_id host N/A app host_server N/A N/A N/A self move_application app N/A move_application N/A N/A self app N/A N/A N/A old_host N/A app host_server N/A cluster_list N/A N/A N/A self manager get_docker_cluster N/A circular_cluster_list N/A CircularList N/A N/A N/A self manager order_cluster_by_load cluster_list N/A N/A N/A app host_server circular_cluster_list N/A N/A index N/A N/A circular_cluster_list index N/A app host_server N/A N/A app host_server N/A N/A circular_cluster_list N/A N/A index 1 hostname N/A N/A N/A app host_server N/A N/A circular_cluster_list N/A 0 hostname N/A N/A N/A N/A self logger info N/A N/A Moving app {app_name} from {old_host} to {new_host} format app_name N/A app hostname old_host old_host new_host N/A app host_server N/A N/A N/A N/A self logger info Bootstrapping the application on the new host N/A N/A N/A self start_application app N/A check_running_application N/A N/A self app N/A N/A N/A N/A N/A ssh N/A N/A paramiko SSHClient N/A N/A N/A ssh set_missing_host_key_policy N/A N/A paramiko AutoAddPolicy N/A N/A N/A N/A self logger info N/A N/A SSHing into host {hostname}:{port} format hostname N/A app host_server port N/A app ssh_port N/A N/A N/A ssh connect hostname N/A app host_server port N/A app ssh_port username root password newroot N/A N/A stdin stdout stderr N/A N/A ssh exec_command pgrep cron N/A output N/A N/A stdout readlines N/A N/A N/A N/A self logger debug output N/A N/A N/A len output 0 N/A N/A N/A N/A N/A self logger info Cron is not running.  Starting it back up N/A N/A stdin stdout stderr N/A N/A ssh exec_command /root/start.sh N/A N/A N/A N/A N/A self logger info Cron is running. N/A N/A N/A ssh close N/A N/A N/A SSHException N/A N/A N/A N/A N/A self logger error Failed to log into server. N/A N/A