<s> """<STR_LIT>""" <EOL> import logging <EOL> from compass . actions import util <EOL> from compass . db . api import cluster as cluster_api <EOL> from compass . db . api import host as host_api <EOL> from compass . db . api import user as user_db <EOL> from compass . deployment . deploy_manager import DeployManager <EOL> from compass . deployment . utils import constants as const <EOL> def os_installed ( <EOL> host_id , clusterhosts_ready , clusters_os_ready , <EOL> username = None <EOL> ) : <EOL> """<STR_LIT>""" <EOL> with util . lock ( '<STR_LIT>' ) as lock : <EOL> if not lock : <EOL> raise Exception ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> logging . info ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> host_id , clusterhosts_ready , clusters_os_ready <EOL> ) <EOL> if username : <EOL> user = user_db . get_user_object ( username ) <EOL> else : <EOL> user = None <EOL> os_installed_triggered = False <EOL> for cluster_id , clusterhost_ready in clusterhosts_ready . items ( ) : <EOL> if not clusterhost_ready and os_installed_triggered : <EOL> continue <EOL> cluster_info = util . ActionHelper . get_cluster_info ( <EOL> cluster_id , user ) <EOL> adapter_id = cluster_info [ const . ADAPTER_ID ] <EOL> adapter_info = util . ActionHelper . get_adapter_info ( <EOL> adapter_id , cluster_id , user ) <EOL> hosts_info = util . ActionHelper . get_hosts_info ( <EOL> cluster_id , [ host_id ] , user ) <EOL> deploy_manager = DeployManager ( <EOL> adapter_info , cluster_info , hosts_info ) <EOL> if not os_installed_triggered : <EOL> deploy_manager . os_installed ( ) <EOL> util . ActionHelper . host_ready ( host_id , True , user ) <EOL> os_installed_triggered = True <EOL> if clusterhost_ready : <EOL> util . ActionHelper . cluster_host_ready ( <EOL> cluster_id , host_id , False , user <EOL> ) <EOL> if util . ActionHelper . is_cluster_os_ready ( cluster_id , user ) : <EOL> logging . info ( "<STR_LIT>" ) <EOL> deploy_manager . cluster_os_installed ( ) <EOL> def package_installed ( <EOL> cluster_id , host_id , cluster_ready , <EOL> host_ready , username = None <EOL> ) : <EOL> """<STR_LIT>""" <EOL> with util . lock ( '<STR_LIT>' ) as lock : <EOL> if not lock : <EOL> raise Exception ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> logging . info ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> cluster_id , host_id , cluster_ready , host_ready <EOL> ) <EOL> if username : <EOL> user = user_db . get_user_object ( username ) <EOL> else : <EOL> user = None <EOL> cluster_info = util . ActionHelper . get_cluster_info ( cluster_id , user ) <EOL> adapter_id = cluster_info [ const . ADAPTER_ID ] <EOL> adapter_info = util . ActionHelper . get_adapter_info ( <EOL> adapter_id , cluster_id , user ) <EOL> hosts_info = util . ActionHelper . get_hosts_info ( <EOL> cluster_id , [ host_id ] , user ) <EOL> deploy_manager = DeployManager ( adapter_info , cluster_info , hosts_info ) <EOL> deploy_manager . package_installed ( ) <EOL> util . ActionHelper . cluster_host_ready ( cluster_id , host_id , True , user ) <EOL> if cluster_ready : <EOL> util . ActionHelper . cluster_ready ( cluster_id , False , user ) <EOL> if host_ready : <EOL> util . ActionHelper . host_ready ( host_id , False , user ) <EOL> def cluster_installed ( <EOL> cluster_id , clusterhosts_ready , <EOL> username = None <EOL> ) : <EOL> """<STR_LIT>""" <EOL> with util . lock ( '<STR_LIT>' ) as lock : <EOL> if not lock : <EOL> raise Exception ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> logging . info ( <EOL> '<STR_LIT>' , <EOL> cluster_id , clusterhosts_ready <EOL> ) <EOL> if username : <EOL> user = user_db . get_user_object ( username ) <EOL> else : <EOL> user = None <EOL> cluster_info = util . ActionHelper . get_cluster_info ( cluster_id , user ) <EOL> adapter_id = cluster_info [ const . ADAPTER_ID ] <EOL> adapter_info = util . ActionHelper . get_adapter_info ( <EOL> adapter_id , cluster_id , user ) <EOL> hosts_info = util . ActionHelper . get_hosts_info ( <EOL> cluster_id , clusterhosts_ready . keys ( ) , user ) <EOL> deploy_manager = DeployManager ( adapter_info , cluster_info , hosts_info ) <EOL> deploy_manager . cluster_installed ( ) <EOL> util . ActionHelper . cluster_ready ( cluster_id , True , user ) <EOL> for host_id , clusterhost_ready in clusterhosts_ready . items ( ) : <EOL> if clusterhost_ready : <EOL> util . ActionHelper . cluster_host_ready ( <EOL> cluster_id , host_id , False , user <EOL> ) </s>
