Lauch SSH error


I refer to this website to create the same thing in ManageIQ.
Method is as follows:
Vm = $evm.root[‘vm’]
$evm.log(“info”,“VM to lauch SSH for is #{vm.hostname[0]}”)

Vm.remote.console_url = “ssh://#{vm.hostname[0]}”
Error message seen on the EVM:
No url was returned from automate.

[----] I, [2019-06-26T18:18:57.579874 #7127:10d6f50] INFO – : User [admin] with current group ID [2000000000002] name [EvmGroup-super_administrator]
[----] I, [2019-06-26T18:18:57.583592 #7127:10d6f50] INFO – : Instantiating [/SYSTEM/PROCESS/Request?MiqServer%3A%3Amiq_server=2000000000001&User%3A%3Auser=2000000000001&VmOrTemplate%3A%3Avm=2000000004535&object_name=Request&request=launch_url_ssh&vmdb_object_type=vm#create]
[----] I, [2019-06-26T18:18:57.618930 #7127:10d6f50] INFO – : Updated namespace [/SYSTEM/PROCESS/Request?MiqServer%3A%3Amiq_server=2000000000001&User%3A%3Auser=2000000000001&VmOrTemplate%3A%3Avm=2000000004535&object_name=Request&request=launch_url_ssh&vmdb_object_type=vm#create ManageIQ/SYSTEM]
[----] I, [2019-06-26T18:18:57.677225 #7127:10d6f50] INFO – : Updated namespace [SYSTEM/PROCESS/parse_provider_category ManageIQ/SYSTEM]
[----] I, [2019-06-26T18:18:57.685012 #7127:10d6f50] INFO – : Invoking [builtin] method [/ManageIQ/System/Process/parse_provider_category] with inputs [{}]
[----] I, [2019-06-26T18:18:57.686317 #7127:10d6f50] INFO – : Setting provider_category to: cloud
[----] I, [2019-06-26T18:18:57.687276 #7127:10d6f50] INFO – : Setting prepend_namespace to: Google
[----] I, [2019-06-26T18:18:57.687443 #7127:10d6f50] INFO – : Prepend namespace [google] during domain search
[----] I, [2019-06-26T18:18:57.687938 #7127:10d6f50] INFO – : Following Relationship [miqaedb:/System/Request/launch_url_ssh#create]
[----] I, [2019-06-26T18:18:57.754149 #7127:10d6f50] INFO – : Updated namespace [miqaedb:/System/Request/launch_url_ssh#create Sample/System]
[----] I, [2019-06-26T18:18:57.869161 #7127:10d6f50] INFO – : Updated namespace [System/Request/launch_url_ssh Sample/System]
[----] I, [2019-06-26T18:18:57.878167 #7127:10d6f50] INFO – : Invoking [inline] method [/Sample/System/Request/launch_url_ssh] with inputs [{}]
[----] I, [2019-06-26T18:18:57.879322 #7127:10d6f50] INFO – : <AEMethod [/Sample/System/Request/launch_url_ssh]> Starting
[----] I, [2019-06-26T18:18:58.488109 #7127:10c2320] INFO – : VM to lauch SSH for is
[----] E, [2019-06-26T18:18:58.493633 #7127:1952044] ERROR – : The following error occurred during method evaluation:
[----] E, [2019-06-26T18:18:58.494455 #7127:1952044] ERROR – : NoMethodError: undefined method remote' for #<MiqAeMethodService::MiqAeServiceManageIQ_Providers_Google_CloudManager_Vm:0x000000001ccadd90> [----] E, [2019-06-26T18:18:58.495531 #7127:1952044] ERROR -- : <AEMethod launch_url_ssh> (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /opt/rh/cfme-gemset/bundler/gems/cfme-automation_engine-e5a6db4ccd64/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:234:inmethod_missing’
(drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1624:in perform_without_block' (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1584:inperform’
(drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1668:in block (2 levels) in main_loop' (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1664:inloop’
(drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1664:in block in main_loop' [----] E, [2019-06-26T18:18:58.504324 #7127:1952044] ERROR -- : Method STDERR: (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /opt/rh/cfme-gemset/bundler/gems/cfme-automation_engine-e5a6db4ccd64/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:234:inmethod_missing’: undefined method remote' for #<MiqAeMethodService::MiqAeServiceManageIQ_Providers_Google_CloudManager_Vm:0x000000001ccadd90> (NoMethodError) [----] E, [2019-06-26T18:18:58.505236 #7127:1952044] ERROR -- : Method STDERR: from (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1624:inperform_without_block’
[----] E, [2019-06-26T18:18:58.506072 #7127:1952044] ERROR – : Method STDERR: from (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1584:in perform' [----] E, [2019-06-26T18:18:58.506706 #7127:1952044] ERROR -- : Method STDERR: from (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1668:inblock (2 levels) in main_loop’
[----] E, [2019-06-26T18:18:58.507590 #7127:1952044] ERROR – : Method STDERR: from (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1664:in loop' [----] E, [2019-06-26T18:18:58.508225 #7127:1952044] ERROR -- : Method STDERR: from (drbunix:///tmp/automation_engine20190626-7127-qz3nbr) /usr/share/ruby/drb/drb.rb:1664:inblock in main_loop’
[----] E, [2019-06-26T18:18:58.509121 #7127:1952044] ERROR – : Method STDERR: from /Sample/System/Request/launch_url_ssh:4:in `’
[----] I, [2019-06-26T18:18:58.533506 #7127:10d6f50] INFO – : <AEMethod [/Sample/System/Request/launch_url_ssh]> Ending
[----] E, [2019-06-26T18:18:58.534888 #7127:10d6f50] ERROR – : Aborting instantiation (unknown method return code) because [Method exited with rc=Unknown RC: [1]]
[----] E, [2019-06-26T18:18:58.534989 #7127:10d6f50] ERROR – : Aborting instantiation (unknown method return code) because [Method exited with rc=Unknown RC: [1]]

I don’t know where to start.

I think you have a typo, try Vm.remote_console_url rather than Vm.remote.console_url

Cheers,
pemcg

I am trying to modify the test to see,
Thank you very much for your reply.

Hi pemcg,
After I changed it, I didn’t jump out of the error log.
But my ssh:// doesn’t bring out IP, do you know why?

Hi Pemcg,

This is LOG does not seem to respond to IP.

[----] I, [2019-06-27T17:33:22.848866 #7185:10d6f50] INFO – : Setting provider_category to: cloud
[----] I, [2019-06-27T17:33:22.849820 #7185:10d6f50] INFO – : Setting prepend_namespace to: Google
[----] I, [2019-06-27T17:33:22.850024 #7185:10d6f50] INFO – : Prepend namespace [google] during domain search
[----] I, [2019-06-27T17:33:22.850608 #7185:10d6f50] INFO – : Following Relationship [miqaedb:/System/Request/launch_url_ssh#create]
[----] I, [2019-06-27T17:33:22.921101 #7185:10d6f50] INFO – : Updated namespace [miqaedb:/System/Request/launch_url_ssh#create Sample/System]
[----] I, [2019-06-27T17:33:23.001403 #7185:10d6f50] INFO – : Updated namespace [System/Request/launch_url_ssh Sample/System]
[----] I, [2019-06-27T17:33:23.006171 #7185:10d6f50] INFO – : Invoking [inline] method [/Sample/System/Request/launch_url_ssh] with inputs [{}]
[----] I, [2019-06-27T17:33:23.007245 #7185:10d6f50] INFO – : <AEMethod [/Sample/System/Request/launch_url_ssh]> Starting
[----] I, [2019-06-27T17:33:23.366044 #7185:10c9350] INFO – : VM to lauch SSH for is
[----] I, [2019-06-27T17:33:23.396568 #7185:10d6f50] INFO – : <AEMethod [/Sample/System/Request/launch_url_ssh]> Ending
[----] I, [2019-06-27T17:33:23.396725 #7185:10d6f50] INFO – : Method exited with rc=MIQ_OK
[----] I, [2019-06-27T17:33:23.397892 #7185:10d6f50] INFO – : Followed Relationship [miqaedb:/System/Request/launch_url_ssh#create]

It seems that variables can’t be brought out,
I set the IP directly to the variable and it can be executed.
But I don’t know why I can’t bring out IP.

@skateman Any ideas here?

Vm = $evm.root[‘vm’]
$evm.log(“info”,“VM to lauch SSH for is #{vm.hostname[0]}”)
Vm.remote.console_url = “ssh://#{vm.hostname[0]}”
Error message seen on the EVM:
No url was returned from automate.

  1. Do not name variables with capital starting letter.
  2. “Vm.remote.console_url” wrong "Vm.remote_console_url = " would be right (except for 1.)

The error message is there (burried I know):

[----] E, [2019-06-26T18:18:58.494455 #7127:1952044] ERROR – : NoMethodError: undefined method remote’ for #

Let me know if you hit into any further issues.

Btw: I am currently extending that mechanism to support multiple other types of objects:

@martinpovolny Hi martinpovolny,
I use lowercase letters as variables,
In addition vm.remote_console_url I also corrected, still did not bring out the variables, do you know what the problem is?

thanks

It seems that VM can’t bring out variables.

vm = $evm.root[‘vm’]
$evm.log(“info”,“VM to lauch SSH for is #{vm.hostnames[0]}”)

vm.remote_console_url = “ssh://#{vm.hostnames[0]}”

[----] I, [2019-07-01T09:17:38.218305 #7324:103df30] INFO – : VM to lauch SSH for is
[----] I, [2019-07-01T09:17:38.278600 #7324:fbef50] INFO – : <AEMethod [/Sample/System/Request/launch_url_ssh]> Ending
[----] I, [2019-07-01T09:17:38.278749 #7324:fbef50] INFO – : Method exited with rc=MIQ_OK
[----] I, [2019-07-01T09:17:38.279341 #7324:fbef50] INFO – : Followed Relationship [miqaedb:/System/Request/launch_url_ssh#create]

The “No url was returned from automate.” is gone?

The “undefined method remote…” is also gone?

Please, try to replace the “ssh://…” with something like “https://google.com”, check if a new window opens (make sure you allow pop-ups). Make sure to use “https” not “http”.

Let’s make sure there’s no problem on the browser side first.

I got it working on my side, but have not tested ‘ssh://…’ URL will test that here too.

@martinpovolny Hi Martinpovlny,

The following two error messages are not reappeared. In addition, I directly plugged in the IP, and the pop-up window is normal and brings out the IP that I brought out of the url.

The “No url was returned from automate.” is gone?

The “undefined method remote…” is also gone?

Then I went through the inspectme ​​to execute, the VM value that should be brought out should be gcp-linux, obviously did not bring out the correct value, and there is no way to bring out the Ip address directly?

Attributes - Begin
INFO – : Attribute - ae_provider_category: cloud
INFO – : Attribute - miq_group: #MiqAeMethodService::MiqAeServiceMiqGroup:0x000000000c2aa8f8
INFO – : Attribute - miq_server: #MiqAeMethodService::MiqAeServiceMiqServer:0x000000000e570400
INFO – : Attribute - miq_server_id: 2000000000001
Attribute - object_name: Request
INFO – : Attribute - request: InspectMe
INFO – : Attribute - tenant: #MiqAeMethodService::MiqAeServiceTenant:0x000000000c2b1b30
INFO – : Attribute - user: #MiqAeMethodService::MiqAeServiceUser:0x000000000bc347f8
INFO – : Attribute - user_id: 2000000000001
INFO – : Attribute - vm: gcp-linux
INFO – : Attribute - vm_id: 2000000004535
INFO – : Attribute - vmdb_object_type: vm

thanks

It is normal to bring in the following directly:

  1. Use https://www.google.com
  2. Use ssh://public ip

I am not sure I uderstand. Are you saying that if you hard-code the URL or IP address the window (or SSH client) opens normally?

If that is the case, then you need to play with logging and Inspect me and figure where is the data that you need.

@martinpovolny Hi Martinpovolny,

Your understanding is not wrong, I am currently looking for the location of the log,
Is there a relevant document to let me inquire?

thanks

@martinpovolny Hi Martinpovolny,
I found a problem that I couldn’t bring out the variable.
It seems that red hat is in the above article, there is a problem with the variable reference.
I changed this to bring out the vm hostname.

=============================
vm = $evm.root[‘vm’]
$evm.log(“info”,“VM to lauch SSH for is #{vm}”)

vm.remote_console_url = “ssh://#{vm}”

But do you know where I can refer to vm ip?

thanks

Sorry, I am not an automate expert.

Seems you got the remote_console_url stuff working that’s where I could help. Not with general automate :frowning:

@martinpovolny Hi Martinpovolny,

Yes, I want to make remote_console_url for all vm. Do you have other ways?

:blush:

@martinpovolny Hi Martinpovolny,

Do you have other ways to achieve the functionality of remote ssh?

thanks