Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reference-repository
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
grid5000
reference-repository
Commits
3746cbb7
Commit
3746cbb7
authored
7 years ago
by
Florent Didier
Browse files
Options
Downloads
Patches
Plain Diff
[dev] check-network-description: check shell calls for errors
parent
26f13113
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
generators/input-validators/check-network-description.rb
+23
-5
23 additions, 5 deletions
generators/input-validators/check-network-description.rb
with
23 additions
and
5 deletions
generators/input-validators/check-network-description.rb
+
23
−
5
View file @
3746cbb7
...
...
@@ -2,6 +2,8 @@
# coding: utf-8
# This script checks the network description for inconsistencies
# This script needs 'nodeset' and 'dot' programs, which are available
# in clustershell and graphviz debian packages
require
'json'
require
'pp'
...
...
@@ -265,7 +267,7 @@ def generate_dot(netnodes, links, site)
# group
nodeslinks
=
nodeslinks
.
group_by
{
|
l
|
[
l
[
'target_cluster'
],
l
[
'attachments'
]
]
}.
to_a
.
map
{
|
e
|
e
[
1
].
map!
{
|
f
|
f
[
'target_node'
]
}
;
e
}
# factor
nodeslinks
.
map!
{
|
e
|
e
[
1
]
=
`
echo
#{
e
[
1
].
uniq
.
join
(
' '
)
}
|nodeset -f
`
.
chomp
;
e
}
nodeslinks
.
map!
{
|
e
|
e
[
1
]
=
sh
(
"
echo
#{
e
[
1
].
uniq
.
join
(
' '
)
}
|nodeset -f
"
)
;
e
}
header
=
[]
content
=
[]
...
...
@@ -316,11 +318,19 @@ def generate_dot(netnodes, links, site)
name
=
"
#{
site
.
capitalize
}
Network"
data
=
[
header
,
content
.
sort
,
trailer
].
flatten
.
join
(
"
\n
"
)
IO
.
write
(
"
#{
name
}
.dot"
,
data
)
s
ystem
(
"dot -Tpdf
#{
name
}
.dot -o
#{
name
}
.pdf"
)
s
ystem
(
"dot -Tpng
#{
name
}
.dot -o
#{
name
}
.png"
)
s
h
(
"dot -Tpdf
#{
name
}
.dot -o
#{
name
}
.pdf"
)
s
h
(
"dot -Tpng
#{
name
}
.dot -o
#{
name
}
.png"
)
end
def
sh
(
cmd
)
begin
output
=
`
#{
cmd
}
`
.
chomp
rescue
StandardError
=>
e
raise
"ERROR: The following command produced an error:
#{
cmd
}
\n
#{
e
}
"
if
$?
.
exitstatus
!=
0
end
return
output
end
if
__FILE__
==
$0
require
'optparse'
...
...
@@ -363,5 +373,13 @@ if __FILE__ == $0
end
end
.
parse!
exit
(
check_network_description
(
options
))
ret
=
2
begin
ret
=
check_network_description
(
options
)
rescue
StandardError
=>
e
puts
e
ret
=
3
ensure
exit
(
ret
)
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment