#NEWLINE# def confirm_hosts_facts( oo_cfg , callback_facts ) : #NEWLINE# #INDENT# hosts = oo_cfg . hosts #NEWLINE# click . clear ( ) #NEWLINE# message = '\nA list of the facts gathered from the provided hosts follows. Because it is\noften the case that the hostname for a system inside the cluster is different\nfrom the hostname that is resolveable from command line or web clients\nthese settings cannot be validated automatically.\n\nFor some cloud providers the installer is able to gather metadata exposed in\nthe instance so reasonable defaults will be provided.\n\nPlese confirm that they are correct before moving forward.\n\n' #NEWLINE# notes = "\nFormat:\n\nconnect_to,IP,public IP,hostname,public hostname\n\nNotes:\n * The installation host is the hostname from the installer's perspective.\n * The IP of the host should be the internal IP of the instance.\n * The public IP should be the externally accessible IP associated with the instance\n * The hostname should resolve to the internal IP from the instances\n   themselves.\n * The public hostname should resolve to the external ip from hosts outside of\n   the cloud.\n" #NEWLINE# output = message #NEWLINE# default_facts_lines = [ ] #NEWLINE# default_facts = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for h in hosts : #NEWLINE# #INDENT# if ( h . preconfigured == True ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# default_facts [ h . connect_to ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# h . ip = callback_facts [ h . connect_to ] [ 'common' ] [ 'ip' ] #NEWLINE# h . public_ip = callback_facts [ h . connect_to ] [ 'common' ] [ 'public_ip' ] #NEWLINE# h . hostname = callback_facts [ h . connect_to ] [ 'common' ] [ 'hostname' ] #NEWLINE# h . public_hostname = callback_facts [ h . connect_to ] [ 'common' ] [ 'public_hostname' ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# click . echo ( 'Problem fetching facts from {}' . format ( h . connect_to ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# default_facts_lines . append ( ',' . join ( [ h . connect_to , h . ip , h . public_ip , h . hostname , h . public_hostname ] ) ) #NEWLINE# output = ( '%s\n%s' % ( output , ',' . join ( [ h . connect_to , h . ip , h . public_ip , h . hostname , h . public_hostname ] ) ) ) #NEWLINE# #UNINDENT# output = ( '%s\n%s' % ( output , notes ) ) #NEWLINE# click . echo ( output ) #NEWLINE# facts_confirmed = click . confirm ( 'Do the above facts look correct?' ) #NEWLINE# if ( not facts_confirmed ) : #NEWLINE# #INDENT# message = ( '\nEdit %s with the desired values and run `atomic-openshift-installer --unattended install` to restart the install.\n' % oo_cfg . config_path ) #NEWLINE# click . echo ( message ) #NEWLINE# oo_cfg . save_to_disk ( ) #NEWLINE# sys . exit ( 0 ) #NEWLINE# #UNINDENT# return default_facts