Jump to content

Making VirtualBox Workflow Act on Remote Machine.


Recommended Posts

Hello,

 

I'm hoping someone will take pity on me and help me iron out this problem, because I'm completely at a loss as to what to do!

 

I've been using a Workflow every day that controls VirtualBox, it works really well but only for virtual machines (VM's) running locally on my laptop.  Unfortunately I've had to move the bulk of my VM's to a remote machine running on my local network, which obviously means that I can no longer use the workflow in its current form to control those remote VM's.

 

So my obvious question is this: is it possible for me to adapt this workflow to control those VM's running on the remote machine, and if so can somebody advise me on how to implement this change please? I've been trying to learn bash scripting for a few months but I have not been having any luck, to be honest I'm not entirely sure where to start when implementing this solution!

 

 

I reached out to the writer of this workflow both on this forum and on his Github about eight months ago, but I guess he must be really busy because I haven't had any reply just yet.  It's a shame, because this must be one of my most used Workflows!  I've forked his repository here if that helps?

 

Anyway, are any of you at a loose end and looking to help nudge a newbie into solving this vexing problem?  There will probably be Karma and cakes in it for you.  :-)

 

Thanks

 

P

 

Link to comment

Theoretically, what you'll need to do is to be able to login to the other machine via the local network and then run the same commands as the workflow does there.

 

So, you'll have to setup ssh access on the other machine, and then you'll have to make sure that you do something to get the correct port / ip address for that machine, login, and run the commands there.

 

Off the top of my head, I can't think of the best way to capture the terminal output and parse it to send stuff back to Alfred, and so the entire approach might be a bit hard to do within a workflow.

 

Usually when workflows interact with external services (because that's now what you're doing), they communicate with some remote API that responds accordingly. So, if you want to emulate that behavior, then you'll basically need turn on Apache on the remote machine and then set up an endpoint that would either follow the commands it was sent or return some data to Alfred so that you could populate the script filters / receive confirmations and errors.

 

Or, I might be missing something completely obvious.

Link to comment

You need to precede all the calls to VBoxManage in the virtualbox_control.sh script and workflow Run Script action with ssh user@machine.name, e.g.:

 

VBoxManage list vms -l | sed -n -e '/^Name/N' -e '/\nGroups/P' -e '/\nGuest OS/p' -e '/^Guest OS/P' -e '/^UUID/P' -e '/^State/P' > ~/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow\ Data/dk.aiyo.VirtualBoxControl/vms
becomes:

ssh user@machine.name "VBoxManage list vms -l | sed -n -e '/^Name/N' -e '/\nGroups/P' -e '/\nGuest OS/p' -e '/^Guest OS/P' -e '/^UUID/P' -e '/^State/P'" > ~/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow\ Data/dk.aiyo.VirtualBoxControl/vms
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...