Skip to content

Commit

Permalink
Address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj committed Jun 5, 2024
1 parent ff2bb65 commit 7428fd8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
8 changes: 5 additions & 3 deletions src/middlewared/middlewared/plugins/catalog/app_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import errno
import os
import stat

from catalog_reader.train_utils import get_train_path

Expand Down Expand Up @@ -51,10 +52,11 @@ def get_app_details(self, app_name, options):
"""
catalog = self.middleware.call_sync('catalog.config')
app_location = os.path.join(get_train_path(catalog['location']), options['train'], app_name)
if not os.path.exists(app_location):
try:
if not stat.S_ISDIR(os.stat(app_location).st_mode):
raise CallError(f'{app_location!r} must be a directory')
except FileNotFoundError:
raise CallError(f'Unable to locate {app_name!r} at {app_location!r}', errno=errno.ENOENT)
elif not os.path.isdir(app_location):
raise CallError(f'{app_location!r} must be a directory')

train_data = self.middleware.call_sync('catalog.apps', {
'retrieve_all_trains': False,
Expand Down
2 changes: 1 addition & 1 deletion src/middlewared/middlewared/plugins/catalog/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def available(self, filters, options):
Retrieve all available applications from all configured catalogs.
"""
if not self.middleware.call_sync('catalog.synced'):
self.middleware.call_sync('catalog.initiate_first_time_sync')
self.middleware.call_sync('catalog.sync').wait_sync()

results = []
installed_apps = [
Expand Down
5 changes: 0 additions & 5 deletions src/middlewared/middlewared/plugins/catalog/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,3 @@ def update_git_repository(self, catalog):
return pull_clone_repository(
catalog['repository'], os.path.dirname(catalog['location']), catalog['branch'],
)

@private
async def initiate_first_time_sync(self):
await (await self.middleware.call('catalog.sync')).wait()
self.SYNCED = True
2 changes: 1 addition & 1 deletion src/middlewared/middlewared/plugins/docker/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def do_update(self, job, data):
config = old_config.copy()
config.update(data)

if len(set(old_config.items()) ^ set(config.items())) > 0:
if old_config != config:
await self.middleware.call('datastore.update', self._config.datastore, old_config['id'], config)

await self.middleware.call('docker.setup.status_change')
Expand Down

0 comments on commit 7428fd8

Please sign in to comment.