From cb76acad993760b2467667e1aa42d164db590ad8 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 12 Apr 2020 11:17:27 +0200 Subject: vyos.util: rename chmod_x() -> chmod_755() --- python/vyos/util.py | 6 +++--- src/conf_mode/interfaces-openvpn.py | 4 ++-- src/conf_mode/interfaces-pppoe.py | 10 +++++----- src/conf_mode/interfaces-wireless.py | 8 ++++---- src/conf_mode/interfaces-wirelessmodem.py | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/python/vyos/util.py b/python/vyos/util.py index 9ca229136..7308dd9b5 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -24,7 +24,7 @@ from subprocess import DEVNULL def debug(flag): """ - Check is a debug flag was set by the user. + Check is a debug flag was set by the user. a flag can be set by touching the file /tmp/vyos.flag.debug with flag being the flag name, the current flags are: - developer: the code will drop into PBD on un-handled exception @@ -205,8 +205,8 @@ def chmod_750(path): os.chmod(path, bitmask) -def chmod_x(path): - """ make file executable """ +def chmod_755(path): + """ make file executable by all """ from stat import S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IXGRP, S_IROTH, S_IXOTH if os.path.exists(path): diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 28a2cc22e..b3bc78150 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -29,7 +29,7 @@ from shutil import rmtree from vyos.config import Config from vyos.defaults import directories as vyos_data_dir from vyos.ifconfig import VTunIf -from vyos.util import call, is_bridge_member, chown, chmod_x +from vyos.util import call, is_bridge_member, chown, chmod_755 from vyos.validate import is_addr_assigned from vyos import ConfigError @@ -104,7 +104,7 @@ def openvpn_mkdir(directory): os.mkdir(directory) # fix permissions - corresponds to mode 755 - chmod_x(directory) + chmod_755(directory) chown(directory, user, group) def fixup_permission(filename, permission=S_IRUSR): diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index 353a5a12c..8eed3159d 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -24,7 +24,7 @@ from netifaces import interfaces from vyos.config import Config from vyos.defaults import directories as vyos_data_dir from vyos.ifconfig import Interface -from vyos.util import chown, chmod_x, cmd +from vyos.util import chown, chmod_755, cmd from vyos import ConfigError default_config_data = { @@ -225,10 +225,10 @@ def generate(pppoe): f.write(config_text) # make generated script file executable - chmod_x(script_pppoe_pre_up) - chmod_x(script_pppoe_ip_up) - chmod_x(script_pppoe_ip_down) - chmod_x(script_pppoe_ipv6_up) + chmod_755(script_pppoe_pre_up) + chmod_755(script_pppoe_ip_up) + chmod_755(script_pppoe_ip_down) + chmod_755(script_pppoe_ipv6_up) return None diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py index 037614194..9331864bc 100755 --- a/src/conf_mode/interfaces-wireless.py +++ b/src/conf_mode/interfaces-wireless.py @@ -29,7 +29,7 @@ from vyos.configdict import list_diff, vlan_to_dict from vyos.defaults import directories as vyos_data_dir from vyos.ifconfig import WiFiIf from vyos.ifconfig_vlan import apply_vlan_config, verify_vlan_config -from vyos.util import process_running, chmod_x, chown, run, is_bridge_member +from vyos.util import process_running, chmod_755, chown, run, is_bridge_member from vyos import ConfigError user = 'root' @@ -120,7 +120,7 @@ def get_conf_file(conf_type, intf): # create directory on demand if not os.path.exists(cfg_dir): os.mkdir(cfg_dir) - chmod_x(cfg_dir) + chmod_755(cfg_dir) chown(cfg_dir, user, group) cfg_file = cfg_dir + r'/{}.cfg'.format(intf) @@ -132,7 +132,7 @@ def get_pid(conf_type, intf): # create directory on demand if not os.path.exists(cfg_dir): os.mkdir(cfg_dir) - chmod_x(cfg_dir) + chmod_755(cfg_dir) chown(cfg_dir, user, group) cfg_file = cfg_dir + r'/{}.pid'.format(intf) @@ -145,7 +145,7 @@ def get_wpa_suppl_config_name(intf): # create directory on demand if not os.path.exists(cfg_dir): os.mkdir(cfg_dir) - chmod_x(cfg_dir) + chmod_755(cfg_dir) chown(cfg_dir, user, group) cfg_file = cfg_dir + r'/{}.cfg'.format(intf) diff --git a/src/conf_mode/interfaces-wirelessmodem.py b/src/conf_mode/interfaces-wirelessmodem.py index c44a993c4..a37e47ada 100755 --- a/src/conf_mode/interfaces-wirelessmodem.py +++ b/src/conf_mode/interfaces-wirelessmodem.py @@ -23,7 +23,7 @@ from netifaces import interfaces from vyos.config import Config from vyos.defaults import directories as vyos_data_dir -from vyos.util import chown, chmod_x, is_bridge_member +from vyos.util import chown, chmod_755, is_bridge_member from vyos.util import cmd from vyos.util import call from vyos import ConfigError @@ -205,9 +205,9 @@ def generate(wwan): f.write(config_text) # make generated script file executable - chmod_x(script_wwan_pre_up) - chmod_x(script_wwan_ip_up) - chmod_x(script_wwan_ip_down) + chmod_755(script_wwan_pre_up) + chmod_755(script_wwan_ip_up) + chmod_755(script_wwan_ip_down) return None -- cgit v1.2.3