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
a09521ca
authored
Jul 23, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agent activity readable names
parent
9ec12e11
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
circle/vm/tasks/local_agent_tasks.py
+20
-11
No files found.
circle/vm/tasks/local_agent_tasks.py
View file @
a09521ca
...
...
@@ -25,22 +25,25 @@ from StringIO import StringIO
from
tarfile
import
TarFile
,
TarInfo
from
django.conf
import
settings
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_noop
from
celery.result
import
TimeoutError
from
monitor.client
import
Client
def
send_init_commands
(
instance
,
act
,
vm
):
queue
=
instance
.
get_remote_queue_name
(
"agent"
)
with
act
.
sub_activity
(
'cleanup'
):
with
act
.
sub_activity
(
'cleanup'
,
readable_name
=
ugettext_noop
(
'cleanup'
)):
cleanup
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
with
act
.
sub_activity
(
'restart_networking'
):
with
act
.
sub_activity
(
'restart_networking'
,
readable_name
=
ugettext_noop
(
'restart networking'
)):
restart_networking
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
with
act
.
sub_activity
(
'change_password'
):
with
act
.
sub_activity
(
'change_password'
,
readable_name
=
ugettext_noop
(
'change password'
)):
change_password
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
instance
.
pw
))
with
act
.
sub_activity
(
'set_time'
):
with
act
.
sub_activity
(
'set_time'
,
readable_name
=
ugettext_noop
(
'set time'
)
):
set_time
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
time
.
time
()))
with
act
.
sub_activity
(
'set_hostname'
):
with
act
.
sub_activity
(
'set_hostname'
,
readable_name
=
ugettext_noop
(
'set hostname'
)):
set_hostname
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
instance
.
primary_host
.
hostname
))
...
...
@@ -73,13 +76,17 @@ def agent_started(vm, version=None):
initialized
=
InstanceActivity
.
objects
.
filter
(
instance
=
instance
,
activity_code
=
'vm.Instance.agent.cleanup'
)
.
exists
()
with
instance_activity
(
code_suffix
=
'agent'
,
instance
=
instance
)
as
act
:
with
act
.
sub_activity
(
'starting'
):
with
instance_activity
(
code_suffix
=
'agent'
,
readable_name
=
ugettext_noop
(
'agent'
),
instance
=
instance
)
as
act
:
with
act
.
sub_activity
(
'starting'
,
readable_name
=
ugettext_noop
(
'starting'
)):
pass
if
version
and
version
!=
settings
.
AGENT_VERSION
:
try
:
with
act
.
sub_activity
(
'update'
):
with
act
.
sub_activity
(
'update'
,
readable_name
=
ugettext_noop
(
'update'
)):
update
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
create_agent_tar
()))
.
get
(
timeout
=
10
)
...
...
@@ -91,7 +98,9 @@ def agent_started(vm, version=None):
measure_boot_time
(
instance
)
send_init_commands
(
instance
,
act
,
vm
)
with
act
.
sub_activity
(
'start_access_server'
):
with
act
.
sub_activity
(
'start_access_server'
,
readable_name
=
ugettext_noop
(
'start acces server'
)
):
start_access_server
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
...
...
@@ -122,5 +131,5 @@ def agent_stopped(vm):
qs
=
InstanceActivity
.
objects
.
filter
(
instance
=
instance
,
activity_code
=
'vm.Instance.agent'
)
act
=
qs
.
latest
(
'id'
)
with
act
.
sub_activity
(
'stopping'
):
with
act
.
sub_activity
(
'stopping'
,
readable_name
=
ugettext_noop
(
'stopping'
)
):
pass
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