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
44cb5496
authored
Aug 08, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: extract local_agent_tasks.update_agent
parent
5d59c0a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
circle/vm/tasks/local_agent_tasks.py
+23
-10
No files found.
circle/vm/tasks/local_agent_tasks.py
View file @
44cb5496
...
...
@@ -86,18 +86,11 @@ def agent_started(vm, version=None):
if
version
and
version
!=
settings
.
AGENT_VERSION
:
try
:
with
act
.
sub_activity
(
'update'
,
readable_name
=
create_readable
(
ugettext_noop
(
'update to
%(version)
s'
),
version
=
settings
.
AGENT_VERSION
)
):
update
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
create_agent_tar
()))
.
get
(
timeout
=
10
)
return
update_agent
(
vm
,
instance
,
act
)
except
TimeoutError
:
pass
else
:
return
# agent is going to restart
if
not
initialized
:
measure_boot_time
(
instance
)
...
...
@@ -139,3 +132,23 @@ def agent_stopped(vm):
act
=
qs
.
latest
(
'id'
)
with
act
.
sub_activity
(
'stopping'
,
readable_name
=
ugettext_noop
(
'stopping'
)):
pass
def
update_agent
(
instance
,
vm
,
act
=
None
):
if
act
:
act
.
sub_activity
(
'update'
,
readable_name
=
create_readable
(
ugettext_noop
(
'update to
%(version)
s'
),
version
=
settings
.
AGENT_VERSION
))
else
:
from
vm.models
import
instance_activity
act
=
instance_activity
(
code_suffix
=
'agent.update'
,
instance
=
instance
,
readable_name
=
create_readable
(
ugettext_noop
(
'update agent to
%(version)
s'
),
version
=
settings
.
AGENT_VERSION
))
with
act
:
queue
=
instance
.
get_remote_queue_name
(
"agent"
)
update
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
create_agent_tar
()))
.
get
(
timeout
=
10
)
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