Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b96a124a
authored
Jul 26, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: remove Instance.change_password
parent
4075d7a1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
16 deletions
+11
-16
circle/dashboard/templates/dashboard/vm-detail.html
+1
-1
circle/vm/models/__init__.py
+2
-1
circle/vm/models/instance.py
+1
-12
circle/vm/operations.py
+7
-2
No files found.
circle/dashboard/templates/dashboard/vm-detail.html
View file @
b96a124a
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
<dd
style=
"font-size: 10px; text-align: right; padding-top: 8px;"
>
<dd
style=
"font-size: 10px; text-align: right; padding-top: 8px;"
>
<div
id=
"vm-details-pw-reset"
>
<div
id=
"vm-details-pw-reset"
>
{% with op=op.password_reset %}{% if op %}
{% with op=op.password_reset %}{% if op %}
<a
href=
"{{op.get_url}}"
class=
"
operation
btn btn-default btn-xs"
{%
if
op
.
disabled
%}
disabled
{%
endif
%}
>
{% trans "Generate new password!" %}
</a>
<a
href=
"{{op.get_url}}"
class=
"btn btn-default btn-xs"
{%
if
op
.
disabled
%}
disabled
{%
endif
%}
>
{% trans "Generate new password!" %}
</a>
{% endif %}{% endwith %}
{% endif %}{% endwith %}
</div>
</div>
</dd>
</dd>
...
...
circle/vm/models/__init__.py
View file @
b96a124a
...
@@ -13,6 +13,7 @@ from .instance import InstanceTemplate
...
@@ -13,6 +13,7 @@ from .instance import InstanceTemplate
from
.instance
import
Instance
from
.instance
import
Instance
from
.instance
import
post_state_changed
from
.instance
import
post_state_changed
from
.instance
import
pre_state_changed
from
.instance
import
pre_state_changed
from
.instance
import
pwgen
from
.network
import
InterfaceTemplate
from
.network
import
InterfaceTemplate
from
.network
import
Interface
from
.network
import
Interface
from
.node
import
Node
from
.node
import
Node
...
@@ -22,5 +23,5 @@ __all__ = [
...
@@ -22,5 +23,5 @@ __all__ = [
'NamedBaseResourceConfig'
,
'VirtualMachineDescModel'
,
'InstanceTemplate'
,
'NamedBaseResourceConfig'
,
'VirtualMachineDescModel'
,
'InstanceTemplate'
,
'Instance'
,
'instance_activity'
,
'post_state_changed'
,
'pre_state_changed'
,
'Instance'
,
'instance_activity'
,
'post_state_changed'
,
'pre_state_changed'
,
'InterfaceTemplate'
,
'Interface'
,
'Trait'
,
'Node'
,
'NodeActivity'
,
'Lease'
,
'InterfaceTemplate'
,
'Interface'
,
'Trait'
,
'Node'
,
'NodeActivity'
,
'Lease'
,
'node_activity'
,
'node_activity'
,
'pwgen'
]
]
circle/vm/models/instance.py
View file @
b96a124a
...
@@ -43,7 +43,7 @@ from taggit.managers import TaggableManager
...
@@ -43,7 +43,7 @@ from taggit.managers import TaggableManager
from
acl.models
import
AclBase
from
acl.models
import
AclBase
from
common.models
import
create_readable
from
common.models
import
create_readable
from
common.operations
import
OperatedMixin
from
common.operations
import
OperatedMixin
from
..tasks
import
vm_tasks
,
agent_tasks
from
..tasks
import
vm_tasks
from
.activity
import
(
ActivityInProgressError
,
instance_activity
,
from
.activity
import
(
ActivityInProgressError
,
instance_activity
,
InstanceActivity
)
InstanceActivity
)
from
.common
import
BaseResourceConfigModel
,
Lease
from
.common
import
BaseResourceConfigModel
,
Lease
...
@@ -719,17 +719,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -719,17 +719,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
timezone
.
now
()
+
lease
.
suspend_interval
,
timezone
.
now
()
+
lease
.
suspend_interval
,
timezone
.
now
()
+
lease
.
delete_interval
)
timezone
.
now
()
+
lease
.
delete_interval
)
def
change_password
(
self
):
"""Generate new password for the vm
:param self: The virtual machine.
"""
self
.
pw
=
pwgen
()
queue
=
self
.
get_remote_queue_name
(
"agent"
)
agent_tasks
.
change_password
.
apply_async
(
queue
=
queue
,
args
=
(
self
.
vm_name
,
self
.
pw
))
self
.
save
()
def
select_node
(
self
):
def
select_node
(
self
):
"""Returns the node the VM should be deployed or migrated to.
"""Returns the node the VM should be deployed or migrated to.
"""
"""
...
...
circle/vm/operations.py
View file @
b96a124a
...
@@ -33,8 +33,9 @@ from .tasks.local_tasks import (
...
@@ -33,8 +33,9 @@ from .tasks.local_tasks import (
)
)
from
.models
import
(
from
.models
import
(
Instance
,
InstanceActivity
,
InstanceTemplate
,
Interface
,
Node
,
Instance
,
InstanceActivity
,
InstanceTemplate
,
Interface
,
Node
,
NodeActivity
,
NodeActivity
,
pwgen
)
)
from
.tasks
import
agent_tasks
logger
=
getLogger
(
__name__
)
logger
=
getLogger
(
__name__
)
...
@@ -883,7 +884,11 @@ class PasswordResetOperation(InstanceOperation):
...
@@ -883,7 +884,11 @@ class PasswordResetOperation(InstanceOperation):
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
def
_operation
(
self
):
def
_operation
(
self
):
self
.
instance
.
change_password
()
self
.
instance
.
pw
=
pwgen
()
queue
=
self
.
instance
.
get_remote_queue_name
(
"agent"
)
agent_tasks
.
change_password
.
apply_async
(
queue
=
queue
,
args
=
(
self
.
instance
.
vm_name
,
self
.
instance
.
pw
))
self
.
instance
.
save
()
register_operation
(
PasswordResetOperation
)
register_operation
(
PasswordResetOperation
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment