Commit ad35a055 by Czémán Arnold

dashboard, storage, vm: remove secret

parent a352d93c
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
"fields": { "fields": {
"type": "file", "type": "file",
"ceph_user": null, "ceph_user": null,
"secret": null,
"path": "/disks", "path": "/disks",
"hostname": "wut", "hostname": "wut",
"name": "diszkek" "name": "diszkek"
......
...@@ -36,7 +36,6 @@ from crispy_forms.layout import ( ...@@ -36,7 +36,6 @@ from crispy_forms.layout import (
) )
from crispy_forms.utils import render_field from crispy_forms.utils import render_field
from crispy_forms.bootstrap import FormActions
from django import forms from django import forms
from django.contrib.auth.forms import UserCreationForm as OrgUserCreationForm from django.contrib.auth.forms import UserCreationForm as OrgUserCreationForm
...@@ -1661,7 +1660,6 @@ class CephDataStoreForm(DataStoreForm): ...@@ -1661,7 +1660,6 @@ class CephDataStoreForm(DataStoreForm):
Fieldset( Fieldset(
'', '',
'ceph_user', 'ceph_user',
'secret',
) )
) )
return helper return helper
...@@ -1669,7 +1667,7 @@ class CephDataStoreForm(DataStoreForm): ...@@ -1669,7 +1667,7 @@ class CephDataStoreForm(DataStoreForm):
class Meta: class Meta:
model = DataStore model = DataStore
fields = ("type", "name", "path", "hostname", fields = ("type", "name", "path", "hostname",
"ceph_user", "secret",) "ceph_user",)
class StorageListSearchForm(forms.Form): class StorageListSearchForm(forms.Form):
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
<fieldset> <fieldset>
<legend>{% trans "Ceph block storage authentication settings" %}</legend> <legend>{% trans "Ceph block storage authentication settings" %}</legend>
{{ form.ceph_user|as_crispy_field }} {{ form.ceph_user|as_crispy_field }}
{{ form.secret|as_crispy_field }}
</fieldset> </fieldset>
{% endif %} {% endif %}
......
...@@ -29,7 +29,7 @@ from django.contrib.messages.views import SuccessMessageMixin ...@@ -29,7 +29,7 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.shortcuts import redirect from django.shortcuts import redirect
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from django.http import ( from django.http import (
Http404, HttpResponse, HttpResponseRedirect, JsonResponse Http404, HttpResponseRedirect, JsonResponse
) )
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
...@@ -284,10 +284,8 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView): ...@@ -284,10 +284,8 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
def form_valid(self, form): def form_valid(self, form):
# automatic credential refresh # automatic credential refresh
changed = False changed = (self.object.type == "ceph_block" and
if self.object.type == "ceph_block": self.object.tracker.has_changed("ceph_user"))
changed = (self.object.tracker.has_changed("secret")
or self.object.tracker.has_changed("ceph_user"))
response = super(StorageDetail, self).form_valid(form) response = super(StorageDetail, self).form_valid(form)
if changed: if changed:
nodes = Node.objects.all() nodes = Node.objects.all()
...@@ -295,8 +293,7 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView): ...@@ -295,8 +293,7 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
if node.get_online(): if node.get_online():
node.refresh_credential( node.refresh_credential(
user=self.request.user, user=self.request.user,
username=self.object.ceph_user, username=self.object.ceph_user)
secret=self.object.secret)
return response return response
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('storage', '0009_auto_20160614_1125'),
]
operations = [
migrations.RemoveField(
model_name='datastore',
name='secret',
),
]
...@@ -27,7 +27,7 @@ import re ...@@ -27,7 +27,7 @@ import re
from django.conf import settings from django.conf import settings
from celery.contrib.abortable import AbortableAsyncResult from celery.contrib.abortable import AbortableAsyncResult
from django.db.models import (Model, BooleanField, CharField, DateTimeField, from django.db.models import (Model, BooleanField, CharField, DateTimeField,
ForeignKey, IntegerField, ManyToManyField) ForeignKey)
from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils import timezone from django.utils import timezone
...@@ -71,11 +71,9 @@ class DataStore(Model): ...@@ -71,11 +71,9 @@ class DataStore(Model):
ceph_user = CharField(max_length=255, null=True, blank=True, ceph_user = CharField(max_length=255, null=True, blank=True,
verbose_name=_('Ceph username')) verbose_name=_('Ceph username'))
secret = CharField(max_length=255, null=True, blank=True,
verbose_name=_('secret key'))
destroyed = DateTimeField(blank=True, default=None, null=True) destroyed = DateTimeField(blank=True, default=None, null=True)
tracker = FieldTracker(fields=["ceph_user", "secret"]) tracker = FieldTracker(fields=["ceph_user"])
class Meta: class Meta:
ordering = ['name'] ordering = ['name']
...@@ -460,7 +458,6 @@ class Disk(TimeStampedModel): ...@@ -460,7 +458,6 @@ class Disk(TimeStampedModel):
desc = self.get_vmdisk_desc_for_filesystem() desc = self.get_vmdisk_desc_for_filesystem()
desc["ceph_user"] = self.datastore.ceph_user desc["ceph_user"] = self.datastore.ceph_user
desc["secret"] = self.datastore.secret
return desc return desc
......
...@@ -580,8 +580,7 @@ class MigrateOperation(RemoteInstanceOperation): ...@@ -580,8 +580,7 @@ class MigrateOperation(RemoteInstanceOperation):
if ceph_blocks.exists(): if ceph_blocks.exists():
ds = ceph_blocks[0].datastore ds = ceph_blocks[0].datastore
to_node.refresh_credential(user=user, to_node.refresh_credential(user=user,
username=ds.ceph_user, username=ds.ceph_user)
secret=ds.secret)
with activity.sub_activity( with activity.sub_activity(
'migrate_vm', readable_name=create_readable( 'migrate_vm', readable_name=create_readable(
ugettext_noop("migrate to %(node)s"), node=to_node)): ugettext_noop("migrate to %(node)s"), node=to_node)):
...@@ -1360,11 +1359,11 @@ class RefreshCredentialOperation(RemoteNodeOperation): ...@@ -1360,11 +1359,11 @@ class RefreshCredentialOperation(RemoteNodeOperation):
task = vm_tasks.refresh_credential task = vm_tasks.refresh_credential
def _get_remote_args(self, **kwargs): def _get_remote_args(self, **kwargs):
return [kwargs["username"], kwargs["secret"]] return [kwargs["username"]]
def _operation(self, activity, username, secret): def _operation(self, activity, username):
super(RefreshCredentialOperation, self)._operation( super(RefreshCredentialOperation, self)._operation(
username=username, secret=secret) username=username)
@register_operation @register_operation
......
...@@ -188,5 +188,5 @@ def screenshot(params): ...@@ -188,5 +188,5 @@ def screenshot(params):
@celery.task(name='vmdriver.refresh_secret') @celery.task(name='vmdriver.refresh_secret')
def refresh_credential(user, secret): def refresh_credential(user):
pass pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment