summaryrefslogtreecommitdiff
path: root/python/vyos/util.py
AgeCommit message (Collapse)Author
2020-06-18T2614: add a key mangling option to vyos.config.get_config_dict()Daniil Baturin
2020-05-20util: T2467: fix missing importThomas Mangin
2020-05-19util: T2467: add systemctl to autosudoThomas Mangin
2020-05-19util: T2467: add autosudo as an option to commandThomas Mangin
2020-05-06validator: T2417: try to make the code clearerThomas Mangin
2020-05-04util: T2241: add get_bridge_member_config functionJernej Jakob
Function that parses the config of a bridge member into a dict that is needed to apply all port config when adding a port to a bridge. Needed because other interfaces will be adding themselves to the bridge outside of the bridge conf_mode script and they need a common place to get their config. Can't be put as method of BridgeIf as we can't invoke it without it creating the bridge (create=False raises an exception), we need to get the configuration before we create the interface.
2020-05-04util: T2241: add func that gets interface name from current config levelJernej Jakob
2020-04-27template: T2388: fix typoJohn Estabrook
2020-04-27Merge pull request #381 from thomas-mangin/T2388Christian Poessinger
template: T2388: move mkdir/chmod/chown within render()
2020-04-27template: T2388: move mkdir/chmod/chown within render()Thomas Mangin
2020-04-26util: T2226: a way to report noteworthy eventThomas Mangin
debug.noteworthy can be used to record noteworhy event during the lifetime of the program. Should anything then cause the program to fail and cause an airbag report to the user, then this information will also be included.
2020-04-26util: T2226: expected return code for cmdThomas Mangin
add an option to cmd() allowing to define a list of error codes which are expected when runnin the command. the default is only to expect zero (no error).
2020-04-26util: T2226: better handle stderrThomas Mangin
Do not agreggate stderr with stdout. So if a command reports a message on stderr but does not report an error, it will not be send to the user to confuse him. Explicitely set encoding to utf-8, which does not change the code behaviour but simplify the code.
2020-04-22Merge pull request #360 from thomas-mangin/T2186-syslogChristian Poessinger
airbag: T2186: generic syslog and better text
2020-04-20vyos.util: T2347: call will print output only if non-emptyJohn Estabrook
2020-04-20airbag: T2186: improve information reportedThomas Mangin
2020-04-19bridge: T2232: move helper to vyos.validateChristian Poessinger
2020-04-18ipoe-server: T2324: remove boilerplate code and adjust to other accel ↵Christian Poessinger
implementations
2020-04-15vyos.util: T1607: move imports locally to functions using themChristian Poessinger
2020-04-15dns-forwarding: T2298: fix path to control fileChristian Poessinger
After migrating PowerDNS to systemd and also its configuration files to a volatile directory in commit 77d725f ("dns-forwarding: T2185: move configuration files to volatile /run directory") the path for the control file has not been altered and pushed to the client rec_control binary"
2020-04-13cmd: T2226: improve debuggingThomas Mangin
allow to setup the debugging from environment variables. allow to set the name of the file used for logging change the name of the debug options to be: - developer: enable pdb of raise - log: all logging messages are logged to a file - ifconfig: show on screen action peformed to change intefaces - command: print all the result of command to screen also provide a way to setup the debugging using environment variables.
2020-04-13cmd: T2226: add the a full log of all commandsThomas Mangin
2020-04-12vyos.util: openvpn: migrate to chmod_600()Christian Poessinger
2020-04-12vyos.util: rename chmod_x() -> chmod_755()Christian Poessinger
2020-04-11util: T2226: passthrough for stderr, fix input, always newlineThomas Mangin
Change the code to let stderr passthrough to the screen as it is the behaviout of os.system and subprocess.call/check_out The input feature was not working and was fixed Also always convert '\r\n' to '\n'
2020-04-09util: T2226: os.system was wrongly converted to runThomas Mangin
os.system does print the ouput of the command, run() does not. A new function called call() does the printing and return the error code.
2020-04-09util: T2205: do not display debuging when it is not setThomas Mangin
2020-04-09Merge pull request #314 from thomas-mangin/T2186Christian Poessinger
airbag: T2186: report friendly user message and log to syslog
2020-04-08vyos.util: introduce chmod_750() for files/directoriesChristian Poessinger
2020-04-08vyos-util: rename chown_file() > chown()Christian Poessinger
... to make it clear also directories can be chown(-ed)
2020-04-08logging: T2186: Initial implementation of loggingThomas Mangin
All messages sent to stderr are now logged to syslog. Also should a raise statement not be handled by the program, a friendlier message is sent to the user (with the trace to syslog) It provide a new debug option: /tmp/vyos.developer.debug when the file exists and the code raise without being caught up the program will automatically fall into pdb port-morterm mode allowing to investigate the reason for the failure
2020-04-07bridge: T2232: prevent deletion of enslaved interfacesChristian Poessinger
Interfaces enslaved to a bridge are not allowed to be deleted. If an interface is deleted from the config but it is still enslaved to a bridge will cause a configuration error on the subsequent boot.
2020-04-07vyos.util: T2226: add proper commentsChristian Poessinger
2020-04-06util: T2226: remove all references to subprocess_cmdThomas Mangin
2020-04-06util: T2226: rewrite util to use cmdThomas Mangin
2020-04-06util: T2226: improve popen, cmd and add runThomas Mangin
improves open and cmd adds a new help function run. the extra optional arguments provide all the features of subprocess used by every module of VyOS. popen matches closely subprocess.Popen cmd matches closely subprocess.check_output run matches closely subprocess.call and os.system popen returns the string and errord code cmd returns the string and raise on error (the class can be defined the default is OSError) run returns the return code of the command the options are: shell=None, the code auto-detect is a shell is required decode=None, use .decode() otherwise the encoding will be used env=None, universal_newlines=None: as per subprocess.Popen input=None, timeout=None, stdout=PIPE, stderr=STDOUT, as per Popen.communicate
2020-04-04vyos.util: rename chmod_x_file() to chmod_x()Christian Poessinger
Now both files and directories are supported.
2020-04-04Merge pull request #299 from thomas-mangin/T2205Christian Poessinger
ifconfig: T2205: silence ethtool harmless failures
2020-04-04ifconfig: T2205: silence ethtool harmless failuresThomas Mangin
Not all interface are capable of all features. Since commands are now checked for valid completion, ethtool command failure must be ignored.
2020-04-04vyos.util: use common subprocess_cmd wrapperChristian Poessinger
2020-04-02vyos.util: move import statements next to the helpers using itChristian Poessinger
2020-04-02vyos.util: add chown_file and chmod_x_file helpersChristian Poessinger
2020-03-29vyos.util: increase usage of process_running() and remove duplicated codeChristian Poessinger
OpenVPN, WIFI, SSTP all had the same boiler plate copied about checking if a process associated with a pidfile is running or not. This has been migrated to the common library function vyos.util.process_running().
2020-03-28ipv6: T1831: migrate eui64 addressing to XML and pythonChristian Poessinger
2020-03-28vyos.util: import cleanupChristian Poessinger
Instead of including all functions/classes from a file, only include the ones we really need.
2019-12-03T1801: move escaping of backslashes into configtreeJohn Estabrook
2019-11-17T1801: escape isolated backslashes before passing to ConfigTree()John Estabrook
2019-08-30[op-mode] T1621 rewrite misc commands to python/xml syntaxDmytro Aleksandrov
2019-08-23[op-mode] T1607 rewrite 'reset conntrack', 'reset & show ip[v6]' to ↵Dmytro Aleksandrov
python/xml syntax
2019-07-03T1503: add functions for commit lock checking and waiting.Daniil Baturin