Skip to content

Commit

Permalink
minor code minimization
Browse files Browse the repository at this point in the history
  • Loading branch information
ndenny committed May 23, 2025
1 parent a3fd3ff commit a10fa2e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions bin/bastion.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __init__(self):
def configured(self):
for folder in App.CONF_SEARCH_ORDER:
folder = folder.expanduser()
for confile in folder.rglob("conf-*.yaml"):
for confile in sorted(folder.rglob("conf-*.yaml")):
self.info("reading conf from {}".format(str(folder / confile)))
self.conf.load(folder / confile)
return self
Expand Down Expand Up @@ -994,20 +994,19 @@ def do_become_conductor(self, request):
if zone.dynamic:
ecommand = '{}/bastion.py enroll assets "{}"'.format(str(BIN_PATH), str(zone.ARK))
if not simulated:
logger.debug("executing... {}".format(str(ecommand)))
logger.debug("executing... {}".format(ecommand))
os.system(ecommand)
else:
logger.debug("simulating... {}".format(str(ecommand)))
logger.debug("simulating... {}".format(ecommand))
for site in self.sites:
#-- Queue assets for updates for all of the sites that I'm managing...
for zone in site.zones:
qcommand = '{}/bastion.py queue assets "{}"'.format(str(BIN_PATH), str(zone.ARK))
logger.debug("executing... {}".format(str(qcommand)))
if not simulated:
logger.debug("simulating... {}".format(str(qcommand)))
logger.debug("executing... {}".format(qcommand))
os.system(qcommand)
else:
logger.debug("simulating... {}".format(str(qcommand)))
logger.debug("simulating... {}".format(qcommand))
for site in self.sites:
#-- Spawn a subprocess to pop all of the objects in the queue for each siteXzone combo....
for zone in site.zones:
Expand All @@ -1017,10 +1016,10 @@ def do_become_conductor(self, request):
#-- i.e. disk access for banking is only done when no other processes need the disk.
bcommand = "{} -c 3 -t {}".format(str(IONICE), bcommand)
if not simulated:
logger.debug("executing... {}".format(str(bcommand)))
logger.debug("executing... {}".format(bcommand))
os.system(bcommand)
else:
logger.debug("simulating... {}".format(str(bcommand)))
logger.debug("simulating... {}".format(bcommand))
lastCheckIn = datetime.datetime.now()


Expand Down

0 comments on commit a10fa2e

Please sign in to comment.