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
acb2f78f
authored
Jul 21, 2015
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'agentfix' into 'master'
Fix agent errors See merge request
!343
parents
8981961e
a0ed9745
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
circle/dashboard/models.py
+10
-2
circle/vm/operations.py
+2
-1
No files found.
circle/dashboard/models.py
View file @
acb2f78f
...
@@ -438,10 +438,14 @@ def add_ssh_keys(sender, **kwargs):
...
@@ -438,10 +438,14 @@ def add_ssh_keys(sender, **kwargs):
userkey
=
kwargs
.
get
(
'instance'
)
userkey
=
kwargs
.
get
(
'instance'
)
instances
=
Instance
.
get_objects_with_level
(
instances
=
Instance
.
get_objects_with_level
(
'user'
,
userkey
.
user
)
.
filter
(
status
=
'RUNNING'
)
'user'
,
userkey
.
user
,
disregard_superuser
=
True
)
.
filter
(
status
=
'RUNNING'
)
for
i
in
instances
:
for
i
in
instances
:
logger
.
info
(
'called add_keys(
%
s,
%
s)'
,
i
,
userkey
)
logger
.
info
(
'called add_keys(
%
s,
%
s)'
,
i
,
userkey
)
try
:
i
.
install_keys
(
user
=
userkey
.
user
,
keys
=
[
userkey
.
key
])
i
.
install_keys
(
user
=
userkey
.
user
,
keys
=
[
userkey
.
key
])
except
Instance
.
NoAgentError
:
logger
.
info
(
"
%
s has no agent running"
,
i
)
def
del_ssh_keys
(
sender
,
**
kwargs
):
def
del_ssh_keys
(
sender
,
**
kwargs
):
...
@@ -449,10 +453,14 @@ def del_ssh_keys(sender, **kwargs):
...
@@ -449,10 +453,14 @@ def del_ssh_keys(sender, **kwargs):
userkey
=
kwargs
.
get
(
'instance'
)
userkey
=
kwargs
.
get
(
'instance'
)
instances
=
Instance
.
get_objects_with_level
(
instances
=
Instance
.
get_objects_with_level
(
'user'
,
userkey
.
user
)
.
filter
(
status
=
'RUNNING'
)
'user'
,
userkey
.
user
,
disregard_superuser
=
True
)
.
filter
(
status
=
'RUNNING'
)
for
i
in
instances
:
for
i
in
instances
:
logger
.
info
(
'called del_keys(
%
s,
%
s)'
,
i
,
userkey
)
logger
.
info
(
'called del_keys(
%
s,
%
s)'
,
i
,
userkey
)
try
:
i
.
remove_keys
(
user
=
userkey
.
user
,
keys
=
[
userkey
.
key
])
i
.
remove_keys
(
user
=
userkey
.
user
,
keys
=
[
userkey
.
key
])
except
Instance
.
NoAgentError
:
logger
.
info
(
"
%
s has no agent running"
,
i
)
post_save
.
connect
(
add_ssh_keys
,
sender
=
UserKey
)
post_save
.
connect
(
add_ssh_keys
,
sender
=
UserKey
)
...
...
circle/vm/operations.py
View file @
acb2f78f
...
@@ -191,7 +191,8 @@ class EnsureAgentMixin(object):
...
@@ -191,7 +191,8 @@ class EnsureAgentMixin(object):
try
:
try
:
InstanceActivity
.
objects
.
filter
(
InstanceActivity
.
objects
.
filter
(
activity_code
=
"vm.Instance.agent.starting"
,
activity_code
=
"vm.Instance.agent.starting"
,
started__gt
=
last_boot_time
)
.
latest
(
"started"
)
started__gt
=
last_boot_time
,
instance
=
self
.
instance
)
.
latest
(
"started"
)
except
InstanceActivity
.
DoesNotExist
:
# no agent since last boot
except
InstanceActivity
.
DoesNotExist
:
# no agent since last boot
raise
self
.
instance
.
NoAgentError
(
self
.
instance
)
raise
self
.
instance
.
NoAgentError
(
self
.
instance
)
...
...
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