Skip to content

Commit

Permalink
Don't run boot on object kinds other than svc and vol
Browse files Browse the repository at this point in the history
No useful and avoids usr, cfg, sec object to report a call for
an unimplemented action.
  • Loading branch information
cvaroqui committed Jul 29, 2019
1 parent 03eb23d commit c874693
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/osvcd_mon.py
Expand Up @@ -706,7 +706,7 @@ def services_init_status(self):
) )


def services_init_boot(self): def services_init_boot(self):
proc = self.service_command(",".join(list_services()), ["boot", "--parallel"]) proc = self.service_command(",".join(list_services(kinds=["vol", "svc"])), ["boot", "--parallel"])
self.push_proc( self.push_proc(
proc=proc, proc=proc,
on_success="services_init_status_callback", on_success="services_init_status_callback",
Expand Down
15 changes: 12 additions & 3 deletions lib/rcUtilities.py
Expand Up @@ -1153,7 +1153,7 @@ def daemon_test_lock():
# #
############################################################################# #############################################################################


def is_service(f, namespace=None, data=None, local=False): def is_service(f, namespace=None, data=None, local=False, kinds=None):
if f is None: if f is None:
return return
f = re.sub(".conf$", "", f) f = re.sub(".conf$", "", f)
Expand All @@ -1162,6 +1162,8 @@ def is_service(f, namespace=None, data=None, local=False):
name, namespace, kind = split_path(f) name, namespace, kind = split_path(f)
except ValueError: except ValueError:
return return
if kinds and kind not in kinds:
return
path = fmt_path(name, namespace, kind) path = fmt_path(name, namespace, kind)
if not local: if not local:
try: try:
Expand All @@ -1175,14 +1177,14 @@ def is_service(f, namespace=None, data=None, local=False):
return return
return path return path


def list_services(namespace=None): def list_services(namespace=None, kinds=None):
l = [] l = []
if namespace in (None, "root"): if namespace in (None, "root"):
for name in glob_root_config(): for name in glob_root_config():
s = name[:-5] s = name[:-5]
if len(s) == 0: if len(s) == 0:
continue continue
path = is_service(name) path = is_service(name, kinds=kinds)
if path is None: if path is None:
continue continue
l.append(path) l.append(path)
Expand All @@ -1191,6 +1193,13 @@ def list_services(namespace=None):
path = path[n:-5] path = path[n:-5]
if path[-1] == os.sep: if path[-1] == os.sep:
continue continue
if kinds:
try:
name, namespace, kind = split_path(path)
except ValueError:
continue
if kind not in kinds:
continue
l.append(path) l.append(path)
return l return l


Expand Down

0 comments on commit c874693

Please sign in to comment.