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
82073b6f
authored
Apr 10, 2013
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: random fixes
fixes
#117
parent
3f526ee4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
miscellaneous/celery/opennebula_celery.py
+2
-0
one/jobs/hourly/scheduled_vm_cleanup.py
+4
-2
one/models.py
+2
-0
No files found.
miscellaneous/celery/opennebula_celery.py
View file @
82073b6f
...
@@ -171,6 +171,8 @@ def update_state(one_id):
...
@@ -171,6 +171,8 @@ def update_state(one_id):
(
out
,
err
)
=
proc
.
communicate
()
(
out
,
err
)
=
proc
.
communicate
()
state
=
'UNKNOWN'
state
=
'UNKNOWN'
try
:
try
:
if
(
len
(
sys
.
argv
)
==
3
and
sys
.
argv
[
2
]
==
'UNKNOWN'
):
raise
Exception
(
':('
)
from
xml.dom.minidom
import
parse
,
parseString
from
xml.dom.minidom
import
parse
,
parseString
x
=
parseString
(
out
)
x
=
parseString
(
out
)
state
=
x
.
getElementsByTagName
(
"STATE"
)[
0
]
.
childNodes
[
0
]
.
nodeValue
state
=
x
.
getElementsByTagName
(
"STATE"
)[
0
]
.
childNodes
[
0
]
.
nodeValue
...
...
one/jobs/hourly/scheduled_vm_cleanup.py
View file @
82073b6f
...
@@ -28,7 +28,8 @@ class Job(HourlyJob):
...
@@ -28,7 +28,8 @@ class Job(HourlyJob):
# print i+':'+unicode(d[i])
# print i+':'+unicode(d[i])
# delete
# delete
for
i
in
Instance
.
objects
.
filter
(
state__in
=
[
'ACTIVE'
,
'STOPPED'
],
time_of_delete__isnull
=
False
):
for
i
in
Instance
.
objects
.
filter
(
state__in
=
[
'ACTIVE'
,
'STOPPED'
],
time_of_delete__isnull
=
False
,
waiting
=
False
):
try
:
try
:
translation
.
activate
(
i
.
owner
.
person_set
.
get
()
.
language
)
translation
.
activate
(
i
.
owner
.
person_set
.
get
()
.
language
)
except
:
except
:
...
@@ -47,7 +48,8 @@ class Job(HourlyJob):
...
@@ -47,7 +48,8 @@ class Job(HourlyJob):
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[IK Cloud]
%
s'
%
i
.
name
,
msg
=
msg
)
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[IK Cloud]
%
s'
%
i
.
name
,
msg
=
msg
)
# suspend
# suspend
for
i
in
Instance
.
objects
.
filter
(
state
=
'ACTIVE'
,
time_of_suspend__isnull
=
False
):
for
i
in
Instance
.
objects
.
filter
(
state
=
'ACTIVE'
,
time_of_suspend__isnull
=
False
,
waiting
=
False
):
try
:
try
:
translation
.
activate
(
i
.
owner
.
person_set
.
get
()
.
language
)
translation
.
activate
(
i
.
owner
.
person_set
.
get
()
.
language
)
except
:
except
:
...
...
one/models.py
View file @
82073b6f
...
@@ -571,6 +571,8 @@ class Instance(models.Model):
...
@@ -571,6 +571,8 @@ class Instance(models.Model):
if
self
.
template
.
state
!=
"DONE"
:
if
self
.
template
.
state
!=
"DONE"
:
self
.
check_if_is_save_as_done
()
self
.
check_if_is_save_as_done
()
if
self
.
one_id
and
self
.
state
!=
'DONE'
:
if
self
.
one_id
and
self
.
state
!=
'DONE'
:
self
.
waiting
=
True
self
.
save
()
from
.tasks
import
DeleteInstanceTask
from
.tasks
import
DeleteInstanceTask
DeleteInstanceTask
.
delay
(
one_id
=
self
.
one_id
)
DeleteInstanceTask
.
delay
(
one_id
=
self
.
one_id
)
self
.
firewall_host_delete
()
self
.
firewall_host_delete
()
...
...
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