Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
8c7786a6
authored
Feb 06, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: improve error handling in UpdateNodeOperation
parent
857316e0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
circle/vm/operations.py
+15
-8
No files found.
circle/vm/operations.py
View file @
8c7786a6
...
@@ -1213,7 +1213,8 @@ class UpdateNodeOperation(NodeOperation):
...
@@ -1213,7 +1213,8 @@ class UpdateNodeOperation(NodeOperation):
data
=
data
[
name
]
data
=
data
[
name
]
except
KeyError
:
except
KeyError
:
raise
HumanReadableException
.
create
(
ugettext_noop
(
raise
HumanReadableException
.
create
(
ugettext_noop
(
"No minions matched the target."
))
"No minions matched the target (
%(target)
s). "
"Data: (
%(data)
s)"
),
target
=
name
,
data
=
data
)
if
not
isinstance
(
data
,
dict
):
if
not
isinstance
(
data
,
dict
):
raise
HumanReadableException
.
create
(
ugettext_noop
(
raise
HumanReadableException
.
create
(
ugettext_noop
(
...
@@ -1226,18 +1227,24 @@ class UpdateNodeOperation(NodeOperation):
...
@@ -1226,18 +1227,24 @@ class UpdateNodeOperation(NodeOperation):
'upgrade_packages'
,
'upgrade_packages'
,
readable_name
=
ugettext_noop
(
'upgrade packages'
))
as
sa
:
readable_name
=
ugettext_noop
(
'upgrade packages'
))
as
sa
:
data
=
self
.
minion_cmd
(
'pkg.upgrade'
,
[])
data
=
self
.
minion_cmd
(
'pkg.upgrade'
,
[])
upgraded
=
len
(
filter
(
lambda
x
:
x
[
'old'
]
and
x
[
'new'
],
if
not
data
.
get
(
'result'
):
data
.
values
()))
raise
HumanReadableException
.
create
(
ugettext_noop
(
installed
=
len
(
filter
(
lambda
x
:
not
x
[
'old'
]
and
x
[
'new'
],
"Unhandled exception:
%(msg)
s"
),
msg
=
unicode
(
data
))
data
.
values
()))
removed
=
len
(
filter
(
lambda
x
:
x
[
'old'
]
and
not
x
[
'new'
],
# data = {'vim': {'new': '1.2.7', 'old': '1.3.7'}}
data
.
values
()))
data
=
[
v
for
v
in
data
.
values
()
if
isinstance
(
v
,
dict
)]
upgraded
=
len
([
x
for
x
in
data
if
x
.
get
(
'old'
)
and
x
.
get
(
'new'
)])
installed
=
len
([
x
for
x
in
data
if
not
x
.
get
(
'old'
)
and
x
.
get
(
'new'
)])
removed
=
len
([
x
for
x
in
data
if
x
.
get
(
'old'
)
and
not
x
.
get
(
'new'
)])
sa
.
result
=
create_readable
(
ugettext_noop
(
sa
.
result
=
create_readable
(
ugettext_noop
(
"Upgraded:
%(upgraded)
s, Installed:
%(installed)
s, "
"Upgraded:
%(upgraded)
s, Installed:
%(installed)
s, "
"Removed:
%(removed)
s"
),
upgraded
=
upgraded
,
"Removed:
%(removed)
s"
),
upgraded
=
upgraded
,
installed
=
installed
,
removed
=
removed
)
installed
=
installed
,
removed
=
removed
)
data
=
self
.
minion_cmd
(
'state.sls'
,
[
'node'
,
'nfs-client'
])
data
=
self
.
minion_cmd
(
'state.sls'
,
[
'node'
])
failed
=
0
failed
=
0
for
k
,
v
in
data
.
iteritems
():
for
k
,
v
in
data
.
iteritems
():
logger
.
debug
(
'salt state
%
s
%
s'
,
k
,
v
)
logger
.
debug
(
'salt state
%
s
%
s'
,
k
,
v
)
...
...
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