galaxyproject / cloudlaunch-ui

A user interface for the cloudlaunch app
MIT License
8 stars 13 forks source link

Authenticate with GCE #6

Closed afgane closed 6 years ago

afgane commented 7 years ago

Add UI elements to allow Google Cloud authentication tokens to be captured. This requires https://github.com/galaxyproject/cloudlaunch/issues/78

Technically, GCE requires a credentials file or a dict (see https://github.com/gvlproject/cloudbridge/blob/gce/cloudbridge/cloud/providers/gce/provider.py#L141), which contains a number of fields. Rather than exposing each field, it'll probably be better to just store the contents of the entire file as a blob and use it as a credentials dict when authenticating.

machristie commented 6 years ago

I've finished the implementation and have started testing. Here are some errors I'm running into:

Error when trying to edit a GCE credential and changing the cloud.

Backend tries to lookup the credentials by credentials id and the cloud but doesn't find any. See view_helpers.py:get_credentials_by_id

This looks like it would be an issue for credentials for all cloud types.

I think there are two approaches we could take:

Disallowing editing the cloud in the user interface makes the most sense to me.

I've fixed this on my branch now

Existing issue: cloud selector show clouds of all types

The cloud selector for GCE credentials lists all clouds, not just GCE clouds. Same with AWS, etc.

It shouldn't be too hard to filter the list.

I've fixed this on my branch now

Error getting networks?

I actually don't remember what I was doing in the UI when I got this error. But this is something not yet implemented in the GCE provider that the UI is expecting to be implemented.

[2017-08-09 10:28:05,462 django.request:284 ERROR] Internal Server Error: /api/v1/infrastructure/clouds/us-central1-a/networks/
Traceback (most recent call last):
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/viewsets.py", line 87, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/mixins.py", line 45, in list
    return self.get_paginated_response(serializer.data)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 674, in data
    ret = super(ListSerializer, self).data
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 239, in data
    self._data = self.to_representation(self.instance)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 614, in to_representation
    self.child.to_representation(item) for item in iterable
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 614, in <listcomp>
    self.child.to_representation(item) for item in iterable
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/serializers.py", line 463, in to_representation
    attribute = field.get_attribute(instance)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/fields.py", line 405, in get_attribute
    return get_attribute(instance, self.source_attrs)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/rest_framework/fields.py", line 80, in get_attribute
    instance = getattr(instance, attr)
  File "/Users/machrist/SGCI/cloudlaunch/cloudbridge/cloudbridge/cloudbridge/cloud/providers/gce/resources.py", line 1182, in state
    raise NotImplementedError("To be implemented")
NotImplementedError: To be implemented

Error: failed to launch VM

This is an error in Celery. Another thing not implemented in the GCE provider.

[2017-08-09 10:31:28,693: ERROR/MainProcess] Task baselaunch.tasks.launch_appliance[66e4ca1f-9bdd-4ae7-bf43-0e9e5ba6ac58] raised unexpected: NotImplementedError('To be implemented',)
Traceback (most recent call last):
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/venv/lib/python3.6/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/cloudlaunch/django-cloudlaunch/baselaunch/tasks.py", line 44, in launch_appliance
    app_config, user_data)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/cloudlaunch/django-cloudlaunch/baselaunch/backend_plugins/base_vm_app.py", line 239, in launch_app
    provider, cloudlaunch_config)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/cloudlaunch/django-cloudlaunch/baselaunch/backend_plugins/base_vm_app.py", line 215, in resolve_launch_properties
    subnet_id = self.get_or_create_subnet(provider, net_id, placement)
  File "/Users/machrist/SGCI/cloudlaunch/launcher/cloudlaunch/django-cloudlaunch/baselaunch/backend_plugins/base_vm_app.py", line 201, in get_or_create_subnet
    sn = provider.network.subnets.get_or_create_default(placement)
  File "/Users/machrist/SGCI/cloudlaunch/cloudbridge/cloudbridge/cloudbridge/cloud/providers/gce/services.py", line 807, in get_or_create_default
    raise NotImplementedError('To be implemented')
NotImplementedError: To be implemented
machristie commented 6 years ago

I fixed the two UI issues I mentioned in the previous comment on my branch. Still to do:

machristie commented 6 years ago

Documenting what I had to do to upgrade to Angular 4, with regards to npm modules: