Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9e60b9b7
authored
Jul 15, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
operations: added missing preconditions
parent
cbcf6f97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
circle/vm/operations.py
+11
-1
No files found.
circle/vm/operations.py
View file @
9e60b9b7
...
...
@@ -90,6 +90,11 @@ class AddInterfaceOperation(InstanceOperation):
"the VM."
)
required_perms
=
()
def
check_precond
(
self
):
super
(
AddInterfaceOperation
,
self
)
.
check_precond
()
if
self
.
instance
.
status
not
in
[
'STOPPED'
,
'PENDING'
,
'RUNNING'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
def
_operation
(
self
,
activity
,
user
,
system
,
vlan
,
managed
=
None
):
if
managed
is
None
:
managed
=
vlan
.
managed
...
...
@@ -344,6 +349,11 @@ class RemoveInterfaceOperation(InstanceOperation):
description
=
_
(
"Remove the specified network interface from the VM."
)
required_perms
=
()
def
check_precond
(
self
):
super
(
RemoveInterfaceOperation
,
self
)
.
check_precond
()
if
self
.
instance
.
status
not
in
[
'STOPPED'
,
'PENDING'
,
'RUNNING'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
def
_operation
(
self
,
activity
,
user
,
system
,
interface
):
if
self
.
instance
.
is_running
:
self
.
instance
.
detach_network
(
interface
)
...
...
@@ -365,7 +375,7 @@ class RemoveDiskOperation(InstanceOperation):
def
check_precond
(
self
):
super
(
RemoveDiskOperation
,
self
)
.
check_precond
()
if
self
.
instance
.
status
not
in
[
'STOPPED'
,
'RUNNING'
]:
if
self
.
instance
.
status
not
in
[
'STOPPED'
,
'
PENDING'
,
'
RUNNING'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
def
_operation
(
self
,
activity
,
user
,
system
,
disk
):
...
...
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