Page MenuHomeVyOS Platform

Python environment lacks definition of vyos_libexec_dir when calling os.system()
In progress, NormalPublicBUG

Description

Rewriting the SNMP configuration as XML/Python requires that the running VyOS configuration is altered by the python script. This is aweful.

The reason is that if a user specifies a plaintext password it will be converted to an encrypted one during SNMP startup. Later this encrypted pasword is re-read and set as encrypted-key in the running config whereas the plaintext-key node is deleted.

Calling

os.system('/opt/vyatta/sbin/my_delete service snmp v3 user "nms" auth plaintext-key')

Resulted in:

sh: /validate-value.py: No such file or directory

The available environment has been extracted using os.system('env')

The current workaround in https://github.com/vyos/vyos-1x/commit/0d38d4f13c24450aaa7b1a0a748e5f007b73ba8f is more than ugly (definition of the environment variable before calling the script)

Details

Difficulty level
Hard (possibly days)
Version
1.2.0-rolling+201806050337
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

dmbaturin added a subscriber: dmbaturin.

@c-po You've found a workaround, right?

Yes, just pass the variable on calls to os.system()

@dmbaturin the "workaround" and implementation is IMHO super bad (https://github.com/vyos/vyos-1x/blob/current/src/conf_mode/snmp.py#L808-L813) as it uses /opt/vyatta/sbin/my_set or /opt/vyatta/sbin/my_delete.

Can't we use vyos.configtree in a Python script to replace those bad shell calls? I think this would be the best solution!

In other words, does vyos.configtree support the effective configuration?

syncer changed the task status from Open to In progress.Feb 8 2019, 12:03 AM
syncer assigned this task to dmbaturin.
syncer raised the priority of this task from Low to Normal.
zsdc changed Difficulty level from Unknown (require assessment) to Hard (possibly days).Mar 11 2021, 2:19 PM
zsdc set Is it a breaking change? to Unspecified (possibly destroys the router).