Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9cbc7776
authored
Apr 18, 2013
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: fix site name
parent
402d32ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
cloud/settings/base.py
+1
-0
one/jobs/hourly/scheduled_vm_cleanup.py
+20
-10
No files found.
cloud/settings/base.py
View file @
9cbc7776
...
...
@@ -261,6 +261,7 @@ FIREWALL_SETTINGS = {
}
SITE_NAME
=
"IK Cloud"
DEFAULT_FROM_EMAIL
=
"noreply@cloud.ik.bme.hu"
DELETE_VM
=
False
EMAIL_HOST
=
'152.66.243.92'
# giccero ipv4
CLOUD_URL
=
'https://cloud.ik.bme.hu/'
RELEASE
=
subprocess
.
check_output
([
'git'
,
'rev-parse'
,
'--symbolic-full-name'
,
'--abbrev-ref'
,
'HEAD'
])
...
...
one/jobs/hourly/scheduled_vm_cleanup.py
View file @
9cbc7776
...
...
@@ -6,7 +6,7 @@ from one.models import Instance
from
django.template.loader
import
render_to_string
from
one.tasks
import
SendMailTask
from
django.utils.translation
import
ugettext_lazy
as
_
from
cloud.settings
import
CLOUD_URL
as
url
from
django.conf
import
settings
from
django.utils
import
translation
class
Job
(
HourlyJob
):
...
...
@@ -16,6 +16,8 @@ class Job(HourlyJob):
return
(
orig
+
datetime
.
timedelta
(
days
=
days
,
hours
=
hours
))
.
replace
(
minute
=
0
,
second
=
0
,
microsecond
=
0
)
def
execute
(
self
):
url
=
settings
.
CLOUD_URL
site
=
settings
.
SITE_NAME
now
=
datetime
.
datetime
.
utcnow
()
.
replace
(
tzinfo
=
utc
)
d
=
{
'1m'
:
self
.
calc
(
orig
=
now
,
days
=
30
),
...
...
@@ -38,14 +40,18 @@ class Job(HourlyJob):
delete
=
i
.
time_of_delete
.
replace
(
minute
=
0
,
second
=
0
,
microsecond
=
0
)
continue
if
i
.
time_of_delete
<
now
:
# msg = render_to_string('mails/notification-delete-now.txt', { 'user': i.owner, 'instance': i, 'url': url } )
# SendMailTask.delay(to=i.owner.email, subject='[IK Cloud] %s' % i.name, msg=msg)
pass
msg
=
render_to_string
(
'mails/notification-delete-now.txt'
,
{
'user'
:
i
.
owner
,
'instance'
:
i
,
'url'
:
url
,
'site'
:
site
}
)
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[
%
s]
%
s'
%
(
site
,
i
.
name
),
msg
=
msg
)
i
.
one_delete
()
else
:
for
t
in
d
:
if
delete
==
d
[
t
]:
msg
=
render_to_string
(
'mails/notification-delete.txt'
,
{
'user'
:
i
.
owner
,
'instance'
:
i
,
'url'
:
url
}
)
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[IK Cloud]
%
s'
%
i
.
name
,
msg
=
msg
)
msg
=
render_to_string
(
'mails/notification-delete.txt'
,
{
'user'
:
i
.
owner
,
'instance'
:
i
,
'url'
:
url
,
'site'
:
site
}
)
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[
%
s]
%
s'
%
(
site
,
i
.
name
),
msg
=
msg
)
# suspend
for
i
in
Instance
.
objects
.
filter
(
state
=
'ACTIVE'
,
...
...
@@ -58,11 +64,15 @@ class Job(HourlyJob):
suspend
=
i
.
time_of_suspend
.
replace
(
minute
=
0
,
second
=
0
,
microsecond
=
0
)
if
i
.
time_of_suspend
<
now
:
msg
=
render_to_string
(
'mails/notification-suspend-now.txt'
,
{
'user'
:
i
.
owner
,
'instance'
:
i
,
'url'
:
url
}
)
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[IK Cloud]
%
s'
%
i
.
name
,
msg
=
msg
)
msg
=
render_to_string
(
'mails/notification-suspend-now.txt'
,
{
'user'
:
i
.
owner
,
'instance'
:
i
,
'url'
:
url
,
'site'
:
site
}
)
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[
%
s]
%
s'
%
(
site
,
i
.
name
),
msg
=
msg
)
i
.
stop
()
else
:
for
t
in
d
:
if
suspend
==
d
[
t
]:
msg
=
render_to_string
(
'mails/notification-suspend.txt'
,
{
'user'
:
i
.
owner
,
'instance'
:
i
,
'url'
:
url
}
)
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[IK Cloud]
%
s'
%
i
.
name
,
msg
=
msg
)
msg
=
render_to_string
(
'mails/notification-suspend.txt'
,
{
'user'
:
i
.
owner
,
'instance'
:
i
,
'url'
:
url
,
'site'
:
site
}
)
SendMailTask
.
delay
(
to
=
i
.
owner
.
email
,
subject
=
'[
%
s]
%
s'
%
(
site
,
i
.
name
),
msg
=
msg
)
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