AppController/djinn.rb
# An Array of DjinnJobData objects, each of which containing information about
# a node in the currently running AppScale deployment.
An Array of DjinnJobData objects, each of which containing information about
a node in the currently running AppScale deployment.
An Array of DjinnJobData objects each of which containing information about a node in the currently running AppScale deployment .
def copy_encryption_keys(dest_node)
    ip = dest_node.private_ip
    Djinn.log_info("Copying SSH keys to node at IP address #{ip}")
    ssh_key = dest_node.ssh_key
    HelperFunctions.sleep_until_port_is_open(ip, SSH_PORT)
    if ["ec2", "euca"].include?(@options['infrastructure'])
      user_name = "ubuntu"
      enable_root_login(ip, ssh_key, user_name)
    elsif @options['infrastructure'] == "gce"
      Djinn.log_debug("Waiting for SSH keys to get injected to #{ip}.")
      Kernel.sleep(60)
    elsif @options['infrastructure'] == 'azure'
      user_name = 'azureuser'
      enable_root_login(ip, ssh_key, user_name)
    end
    Kernel.sleep(SMALL_WAIT)
    secret_key_loc = "#{APPSCALE_CONFIG_DIR}/secret.key"
    cert_loc = "#{APPSCALE_CONFIG_DIR}/certs/mycert.pem"
    key_loc = "#{APPSCALE_CONFIG_DIR}/certs/mykey.pem"
    HelperFunctions.scp_file(secret_key_loc, secret_key_loc, ip, ssh_key)
    HelperFunctions.scp_file(cert_loc, cert_loc, ip, ssh_key)
    HelperFunctions.scp_file(key_loc, key_loc, ip, ssh_key)
    cloud_keys_dir = File.expand_path("#{APPSCALE_CONFIG_DIR}/keys/cloud1")
    make_dir = "mkdir -p #{cloud_keys_dir}"
    cloud_private_key = "#{cloud_keys_dir}/mykey.pem"
    cloud_cert = "#{cloud_keys_dir}/mycert.pem"
    HelperFunctions.run_remote_command(ip, make_dir, ssh_key, NO_OUTPUT)
    HelperFunctions.scp_file(ssh_key, ssh_key, ip, ssh_key)
    HelperFunctions.scp_file(cloud_private_key, cloud_private_key, ip, ssh_key)
    HelperFunctions.scp_file(cloud_cert, cloud_cert, ip, ssh_key)
    return if @options['infrastructure'] != "gce"
    client_secrets = "#{APPSCALE_CONFIG_DIR}/client_secrets.json"
    gce_oauth = "#{APPSCALE_CONFIG_DIR}/oauth2.dat"
    if File.exists?(client_secrets)
      HelperFunctions.scp_file(client_secrets, client_secrets, ip, ssh_key)
    end
    HelperFunctions.scp_file(gce_oauth, gce_oauth, ip, ssh_key)
  end
def copy_encryption_keys ( dest_node ) ip = dest_node . private_ip Djinn . log_info ( "Copying SSH keys to node at IP address #{ip}" ) ssh_key = dest_node . ssh_key HelperFunctions . sleep_until_port_is_open ( ip , SSH_PORT ) if [ "ec2" , "euca" ] . include? ( @options [ 'infrastructure' ] ) user_name = "ubuntu" enable_root_login ( ip , ssh_key , user_name ) elsif @options [ 'infrastructure' ] == "gce" Djinn . log_debug ( "Waiting for SSH keys to get injected to #{ip}." ) Kernel . sleep ( 60 ) elsif @options [ 'infrastructure' ] == 'azure' user_name = 'azureuser' enable_root_login ( ip , ssh_key , user_name ) end Kernel . sleep ( SMALL_WAIT ) secret_key_loc = "#{APPSCALE_CONFIG_DIR}/secret.key" cert_loc = "#{APPSCALE_CONFIG_DIR}/certs/mycert.pem" key_loc = "#{APPSCALE_CONFIG_DIR}/certs/mykey.pem" HelperFunctions . scp_file ( secret_key_loc , secret_key_loc , ip , ssh_key ) HelperFunctions . scp_file ( cert_loc , cert_loc , ip , ssh_key ) HelperFunctions . scp_file ( key_loc , key_loc , ip , ssh_key ) cloud_keys_dir = File . expand_path ( "#{APPSCALE_CONFIG_DIR}/keys/cloud1" ) make_dir = "mkdir -p #{cloud_keys_dir}" cloud_private_key = "#{cloud_keys_dir}/mykey.pem" cloud_cert = "#{cloud_keys_dir}/mycert.pem" HelperFunctions . run_remote_command ( ip , make_dir , ssh_key , NO_OUTPUT ) HelperFunctions . scp_file ( ssh_key , ssh_key , ip , ssh_key ) HelperFunctions . scp_file ( cloud_private_key , cloud_private_key , ip , ssh_key ) HelperFunctions . scp_file ( cloud_cert , cloud_cert , ip , ssh_key ) return if @options [ 'infrastructure' ] != "gce" client_secrets = "#{APPSCALE_CONFIG_DIR}/client_secrets.json" gce_oauth = "#{APPSCALE_CONFIG_DIR}/oauth2.dat" if File . exists? ( client_secrets ) HelperFunctions . scp_file ( client_secrets , client_secrets , ip , ssh_key ) end HelperFunctions . scp_file ( gce_oauth , gce_oauth , ip , ssh_key ) end
An Array of DjinnJobData objects, each of which containing information about
a node in the currently running AppScale deployment.
An Array of DjinnJobData objects each of which containing information about a node in the currently running AppScale deployment .
# Get the username to use for ssh (depends on environments). # Add deployment key to remote instance's authorized_keys. # Since GCE v1beta15, SSH keys don't immediately get injected to newly # spawned VMs. It takes around 30 seconds, so sleep a bit longer to be # sure. # Finally, on GCE, we need to copy over the user's credentials, in case # nodes need to attach persistent disks.
dest_node
<not_specific>