public AgentProperties findParametersForAmazonOrOpenStack ( Logger logger ) { logger . info ( "User data are being retrieved for AWS / Openstack..." ) ; // Copy the user data String userData = Utils . readUrlContentQuietly ( "http://169.254.169.254/latest/user-data" , logger ) ; String ip = Utils . readUrlContentQuietly ( "http://169.254.169.254/latest/meta-data/public-ipv4" , logger ) ; AgentProperties result = null ; try { // Parse the user data result = AgentProperties . readIaasProperties ( userData , logger ) ; // Verify the IP if ( ! AgentUtils . isValidIP ( ip ) ) { // Failed retrieving public IP: try private one instead ip = Utils . readUrlContentQuietly ( "http://169.254.169.254/latest/meta-data/local-ipv4" , logger ) ; } if ( AgentUtils . isValidIP ( ip ) ) result . setIpAddress ( ip ) ; else logger . severe ( "No IP address could be retrieved (either public-ipv4 or local-ipv4)." ) ; } catch ( IOException e ) { logger . severe ( "The network properties could not be read. " + e . getMessage ( ) ) ; Utils . logException ( logger , e ) ; } return result ; }
Configures the agent from a IaaS registry .