Injecting proxy configuration into remote-viewer (RHEV/oVirt console)
One of the things that bother me is that I have not been able to find an easy
way to change proxy settings when using the remote-viewer
tool to connect
to RHEV/oVirt virtual machines.
Finally I managed to put some thought into how to handle this situation -- and
the easiest way I found is just to puto a wrapper into remote-viewer
so whenver
it's invoked via the browser, it can do all required mangling of the *.vv
file
we just downloaded.
The virt-viwer *.vv
files are just INI files so updating them is usually
quite easy via :
All in all, my wrapper looks like this :
#!/bin/bash # Wrapper around remote-viewer to inject proxy parameters. # Needs ansible, but can be trivially amended to use crudini. export PATH=$PATH:/usr/bin:/usr/sbin path=$1 chmod 600 $path logger $0 $path # Add your magic about detecting whether we need to use a proxy in the 'if' below ;-) if [ $(netstat -putan 2> /dev/null | grep -P ':3128.*LISTEN' -c) -ne 0 ]; then logger $0 enabling proxy ansible -m ini_file localhost -a "state=present section=virt-viewer option=proxy value=\"http://localhost:3128\" path=\"$path\"" ansible -m ini_file localhost -a "state=present section=ovirt option=proxy value=\"http://localhost:3128\" path=\"$path\"" sed -i 's# = #=#g' $path fi #logger < $path /usr/bin/remote-viewer $path exit $?
And then you just need to instruct your browser to launch remote-viewer.sh
rather
than remote-viewer
to have your proxy settings automatically added.
Happy hacking!