Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
circle/dashboard/models.py
+12
-4
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):
userkey
=
kwargs
.
get
(
'instance'
)
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
:
logger
.
info
(
'called add_keys(
%
s,
%
s)'
,
i
,
userkey
)
i
.
install_keys
(
user
=
userkey
.
user
,
keys
=
[
userkey
.
key
])
try
:
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
):
...
...
@@ -449,10 +453,14 @@ def del_ssh_keys(sender, **kwargs):
userkey
=
kwargs
.
get
(
'instance'
)
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
:
logger
.
info
(
'called del_keys(
%
s,
%
s)'
,
i
,
userkey
)
i
.
remove_keys
(
user
=
userkey
.
user
,
keys
=
[
userkey
.
key
])
try
:
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
)
...
...
circle/vm/operations.py
View file @
acb2f78f
...
...
@@ -191,7 +191,8 @@ class EnsureAgentMixin(object):
try
:
InstanceActivity
.
objects
.
filter
(
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
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