Commit ad35a055 by Czémán Arnold

dashboard, storage, vm: remove secret

parent a352d93c
......@@ -22,7 +22,6 @@
"fields": {
"type": "file",
"ceph_user": null,
"secret": null,
"path": "/disks",
"hostname": "wut",
"name": "diszkek"
......
......@@ -36,7 +36,6 @@ from crispy_forms.layout import (
)
from crispy_forms.utils import render_field
from crispy_forms.bootstrap import FormActions
from django import forms
from django.contrib.auth.forms import UserCreationForm as OrgUserCreationForm
......@@ -1661,7 +1660,6 @@ class CephDataStoreForm(DataStoreForm):
Fieldset(
'',
'ceph_user',
'secret',
)
)
return helper
......@@ -1669,7 +1667,7 @@ class CephDataStoreForm(DataStoreForm):
class Meta:
model = DataStore
fields = ("type", "name", "path", "hostname",
"ceph_user", "secret",)
"ceph_user",)
class StorageListSearchForm(forms.Form):
......
......@@ -17,7 +17,6 @@
<fieldset>
<legend>{% trans "Ceph block storage authentication settings" %}</legend>
{{ form.ceph_user|as_crispy_field }}
{{ form.secret|as_crispy_field }}
</fieldset>
{% endif %}
......
......@@ -29,7 +29,7 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.shortcuts import redirect
from django_tables2 import SingleTableView
from django.http import (
Http404, HttpResponse, HttpResponseRedirect, JsonResponse
Http404, HttpResponseRedirect, JsonResponse
)
from django.core.exceptions import PermissionDenied
......@@ -284,10 +284,8 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
def form_valid(self, form):
# automatic credential refresh
changed = False
if self.object.type == "ceph_block":
changed = (self.object.tracker.has_changed("secret")
or self.object.tracker.has_changed("ceph_user"))
changed = (self.object.type == "ceph_block" and
self.object.tracker.has_changed("ceph_user"))
response = super(StorageDetail, self).form_valid(form)
if changed:
nodes = Node.objects.all()
......@@ -295,8 +293,7 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
if node.get_online():
node.refresh_credential(
user=self.request.user,
username=self.object.ceph_user,
secret=self.object.secret)
username=self.object.ceph_user)
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
from django.conf import settings
from celery.contrib.abortable import AbortableAsyncResult
from django.db.models import (Model, BooleanField, CharField, DateTimeField,
ForeignKey, IntegerField, ManyToManyField)
ForeignKey)
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.urlresolvers import reverse
from django.utils import timezone
......@@ -71,11 +71,9 @@ class DataStore(Model):
ceph_user = CharField(max_length=255, null=True, blank=True,
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)
tracker = FieldTracker(fields=["ceph_user", "secret"])
tracker = FieldTracker(fields=["ceph_user"])
class Meta:
ordering = ['name']
......@@ -460,7 +458,6 @@ class Disk(TimeStampedModel):
desc = self.get_vmdisk_desc_for_filesystem()
desc["ceph_user"] = self.datastore.ceph_user
desc["secret"] = self.datastore.secret
return desc
......
......@@ -580,8 +580,7 @@ class MigrateOperation(RemoteInstanceOperation):
if ceph_blocks.exists():
ds = ceph_blocks[0].datastore
to_node.refresh_credential(user=user,
username=ds.ceph_user,
secret=ds.secret)
username=ds.ceph_user)
with activity.sub_activity(
'migrate_vm', readable_name=create_readable(
ugettext_noop("migrate to %(node)s"), node=to_node)):
......@@ -1360,11 +1359,11 @@ class RefreshCredentialOperation(RemoteNodeOperation):
task = vm_tasks.refresh_credential
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(
username=username, secret=secret)
username=username)
@register_operation
......
......@@ -188,5 +188,5 @@ def screenshot(params):
@celery.task(name='vmdriver.refresh_secret')
def refresh_credential(user, secret):
def refresh_credential(user):
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