Greetings!
Fabric seems to ignore dynamic changes happening in the
env.ssh_config_path
It looks like that this file is loaded just once and cached, and any subsequent changes to this file are simply ignored. Below is the example: in the first iteration my code (shown in the end) greps this file, shows that the initial IP address value for remoteit host is ...56, and then correctly executes ifconfig on this host.
30 seconds pass before the next iteration, and during this time I alter the config file, remoteit becomes ...80, as seen on the second grep, but fabric continues to connect to a *stale* address 56
env.ssh_config_path=/home/autotest/code/repo/pftest/conf/ssh/config
[localhost] local: grep -A 1 "remoteit$" /home/autotest/code/repo/pftest/conf/ssh/config
Host remoteit
HostName 10.46.29.56
[remoteit] run: ifconfig | grep "10\.46\."
[remoteit] out: inet addr:10.46.29.56 Bcast:10.46.29.255 Mask:255.255.255.0
env.ssh_config_path=/home/autotest/code/repo/pftest/conf/ssh/config
[localhost] local: grep -A 1 "remoteit$" /home/autotest/code/repo/pftest/conf/ssh/config
Host remoteit
HostName 10.46.29.80
[remoteit] run: ifconfig | grep "10\.46\."
[remoteit] out: inet addr:10.46.29.56 Bcast:10.46.29.255 Mask:255.255.255.0
The full code of the test is:
def tst_03():
while True:
print('env.ssh_config_path={}'.format(env.ssh_config_path))
local('grep -A 1 "remoteit$" {}'.format(env.ssh_config_path))
with settings(use_ssh_config=True, host_string='remoteit', path='/sbin'):
run('ifconfig | grep "10\.46\."')
time.sleep(30) # to let me alter def tst_03():
while True:
print('env.ssh_config_path={}'.format(env.ssh_config_path))
local('grep -A 1 "remoteit$" {}'.format(env.ssh_config_path))
with settings(use_ssh_config=True, host_string='remoteit', path='/sbin'):
run('ifconfig | grep "10\.46\."')
time.sleep(30) # to let me alter
# env.ssh_config_path=/home/autotest/code/repo/pftest/conf/ssh/config