Page MenuHomeVyOS Platform

split the util file
Open, Requires assessmentPublicFEATURE REQUEST

Description

Currently, util contains many things in one file, often unrelated.
A util folder could be created grouping command in logical chunks (command operation, file operation, ...)

process.py:

def popen(command, flag='', shell=None, input=None, timeout=None, env=None,
def run(command, flag='', shell=None, input=None, timeout=None, env=None,
def cmd(command, flag='', shell=None, input=None, timeout=None, env=None,
def call(command, flag='', shell=None, input=None, timeout=None, env=None,

def process_running(pid_file):
def process_named_running(name):
def get_half_cpus():

file.py:

def read_file(fname, defaultonfailure=None):
def read_json(fname, defaultonfailure=None):
def chown(path, user, group):
def chmod(path, bitmask):
def chmod_600(path):
def chmod_750(path):
def chmod_755(path):
def makedir(path, user=None, group=None):
def file_is_persistent(path):

commit.py:

def commit_in_progress():
def wait_for_commit_lock():

interface.py (perhaps should be moved within interface):

def get_bridge_member_config(conf, br, intf):
def ifname_from_config(conf):
def mac2eui64(mac, prefix=None):

rights.py:

def is_admin() -> bool:
def get_cfg_group_id():

various.py:

def seconds_to_human(s, separator=""):
def ask_yes_no(question, default=False) -> bool:
def colon_separated_to_dict(data_string, uniquekeys=False):

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

pasik added a subscriber: pasik.May 19 2020, 7:22 PM
jjakob added a subscriber: jjakob.May 20 2020, 2:10 PM

For get_bridge_member_config, ifname_from_config and maceui64 to be able
to be moved into ifconfig.interfaces T2366 needs to be done first,
otherwise functionality will break.

I'm not sure ifname_from_config's place is in ifconfig, as it operates
purely on vyos.config so it should be a utility of that.

The same with maceui64, which can take any mac to generate an eui64. A
search of all uses of it needs to be done, to see if it's always
invoked on the interface, or if it's used in other places as well.

I have worked and provided a patch for T2485 .. It may be the right place to move it in.