Skip to content

Commit

Permalink
fix #1159 obvious error messages when no configurations match
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Aug 9, 2024
1 parent 10df38e commit 1b9b89b
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions sarracenia/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,8 +1601,8 @@ def declare(self):
flow=None

def disable(self):
if len(self.filtered_configurations) == 0:
logging.error('%s configuration not found', self.leftovers)
if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f"{self.leftovers} configuration not found" )
return

for f in self.filtered_configurations:
Expand Down Expand Up @@ -1667,8 +1667,8 @@ def log(self):
self.run_command(['tail', '-f', lfn])

def enable(self):
if len(self.filtered_configurations) == 0:
logging.error('%s configuration not found', self.leftovers)
if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f'{self.leftovers} configuration not found' )
return
# declare exchanges first.
for f in self.filtered_configurations:
Expand Down Expand Up @@ -1791,6 +1791,10 @@ def foreground(self):

def cleanup(self) -> bool:

if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f'{self.leftovers} configuration not found' )
return

if len(self.filtered_configurations) > 1 :
if len(self.filtered_configurations) != self.options.dangerWillRobinson:
logging.error(
Expand Down Expand Up @@ -2065,8 +2069,8 @@ def config_show(self):

def remove(self):

if len(self.filtered_configurations) == 0:
logging.error("No configuration matched")
if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f"{self.leftovers} configuration not found" )
return

if len(self.filtered_configurations) > 1 :
Expand Down Expand Up @@ -2153,6 +2157,10 @@ def sanity(self):
:return:
"""
if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f"{self.leftovers} configuration not found" )
return

pcount = 0
kill_hung=[]
for f in self.filtered_configurations:
Expand Down Expand Up @@ -2236,6 +2244,10 @@ def start(self):
:return:
"""

if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f"{self.leftovers} configuration not found" )
return

pcount = 0
for f in self.filtered_configurations:

Expand Down Expand Up @@ -2282,13 +2294,16 @@ def stop(self):
return 0 on success, non-zero on failure.
"""

if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f"{self.leftovers} configuration not found" )
return

self._clean_missing_proc_state()

if len(self.procs) == 0:
print('no procs running...already stopped')
return


print('sending SIGTERM ', end='', flush=True)
pcount = 0
fg_instances = set()
Expand Down Expand Up @@ -2536,6 +2551,10 @@ def status(self):
""" v3 Printing prettier statuses for each component/configs found
"""

if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f"{self.leftovers} configuration not found" )
return

flowNameWidth=self.cumulative_stats['flowNameWidth']
latestTransferWidth=self.cumulative_stats['latestTransferWidth']

Expand Down Expand Up @@ -2879,6 +2898,11 @@ def overview(self):
:return:
"""

if len(self.leftovers) > 0 and not self._action_all_configs:
logging.error( f"{self.leftovers} configuration not found" )
return

bad = 0


Expand Down

0 comments on commit 1b9b89b

Please sign in to comment.