Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cutwater committed Sep 19, 2024
1 parent 9f1e9e4 commit 55edf49
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 32 deletions.
16 changes: 0 additions & 16 deletions galaxy_ng/app/api/v1/viewsets/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,6 @@ def get_task(self, request, id=None):
'COMPLETED': 'SUCCESS'
}

# generate a message for the response
# FIXME(cutwater): Begin of the code that does nothing
msg = ''
if state == 'SUCCESS':
msg = 'role imported successfully'
elif state == 'RUNNING':
msg = 'running'

if this_task.error and this_task.error.get('traceback'):
msg = (
this_task.error['description']
+ '\n'
+ this_task.error['traceback']
)
# FIXME(cutwater): End of the code that does nothing

task_messages = []

# get messages from the model if this was a role import
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/management/commands/set-repo-keyring.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def handle(self, *args, **options):
if not options["yes"]:
confirm = input(
f"This will set keyring to {keyring_path} for "
"{repository} repository, " "Proceed? (Y/n)"
f"{repository} repository, Proceed? (Y/n)"
).lower()
while True:
if confirm not in ("y", "n", "yes", "no"):
Expand Down
1 change: 0 additions & 1 deletion galaxy_ng/app/migrations/0038_namespace_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def add_namespace_metadata_to_published_repository(apps, schema_editor):
RepositoryContent = apps.get_model('core', 'RepositoryContent')
RepositoryVersion = apps.get_model('core', 'RepositoryVersion')
RepositoryVersionContentDetails = apps.get_model('core', 'RepositoryVersionContentDetails')
RepositoryVersionContentDetails = apps.get_model('core', 'RepositoryVersionContentDetails')

repo = AnsibleDistribution.objects.get(base_path="published").repository
repo_v = RepositoryVersion.objects.filter(repository=repo).order_by("-number").first()
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/migrations/_dab_rbac.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create_permissions_as_operation(apps, schema_editor):
for app_label in {'ansible', 'container', 'core', 'galaxy'}:
create_dab_permissions(global_apps.get_app_config(app_label), apps=apps)

print(f'FINISHED CREATING PERMISSIONS')
print('FINISHED CREATING PERMISSIONS')


def split_pulp_roles(apps, schema_editor):
Expand Down
6 changes: 3 additions & 3 deletions galaxy_ng/app/utils/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def get_tag_commit_date(git_url, tag, checkout_path=None):
def get_tag_commit_hash(git_url, tag, checkout_path=None):
if checkout_path is None:
checkout_path = tempfile.mkdtemp()
pid = subprocess.run(f'git clone {git_url} {checkout_path}', shell=True)
pid = subprocess.run(
subprocess.run(f'git clone {git_url} {checkout_path}', shell=True)
proc = subprocess.run(
"git log -1 --format='%H'",
shell=True,
cwd=checkout_path,
stdout=subprocess.PIPE
)
commit_hash = pid.stdout.decode('utf-8').strip()
commit_hash = proc.stdout.decode('utf-8').strip()
return commit_hash
12 changes: 6 additions & 6 deletions galaxy_ng/openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class GalaxySchemaGenerator(PulpSchemaGenerator):

def convert_endpoint_path_params(self, path, view, schema):
"""Bypass variable-ization of paths if not a pulp route"""
if hasattr(self, '_input_request'):
if (
self._input_request.path.startswith(settings.GALAXY_API_PATH_PREFIX)
and not self._input_request.path.startswith(settings.API_ROOT)
):
return path
if (
hasattr(self, '_input_request')
and self._input_request.path.startswith(settings.GALAXY_API_PATH_PREFIX)
and not self._input_request.path.startswith(settings.API_ROOT)
):
return path
return super().convert_endpoint_path_params(path, view, schema)

def get_schema(self, request=None, public=False):
Expand Down
5 changes: 1 addition & 4 deletions galaxy_ng/social/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,7 @@ def _ensure_legacynamespace(self, login, v3_namespace):

# make the namespace
with transaction.atomic():
legacy_namespace, created = \
LegacyNamespace.objects.get_or_create(
name=login
)
legacy_namespace, created = LegacyNamespace.objects.get_or_create(name=login)

# bind the v3 namespace
if created or not legacy_namespace.namespace:
Expand Down

0 comments on commit 55edf49

Please sign in to comment.