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
4e3ea3fa
Commit
4e3ea3fa
authored
6 years ago
by
Lucas Nussbaum
Browse files
Options
Downloads
Patches
Plain Diff
[dev] migrate network validator
parent
22c367b3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Rakefile
+17
-0
17 additions, 0 deletions
Rakefile
lib/refrepo/valid/network.rb
+2
-55
2 additions, 55 deletions
lib/refrepo/valid/network.rb
with
19 additions
and
55 deletions
Rakefile
+
17
−
0
View file @
4e3ea3fa
...
...
@@ -79,6 +79,23 @@ namespace :valid do
exit
(
ret
)
end
desc
"Check network description -- parameters: [SITE={grenoble,...}] [VERBOSE=1] GENERATE_DOT=1"
task
"network"
do
require
'refrepo/valid/network'
options
=
{}
options
[
:sites
]
=
(
ENV
[
'SITE'
]
?
ENV
[
'SITE'
].
split
(
','
)
:
G5K_SITES
)
options
[
:verbose
]
=
true
if
ENV
[
'VERBOSE'
]
options
[
:dot
]
=
true
if
ENV
[
'GENERATE_DOT'
]
ret
=
2
begin
ret
=
check_network_description
(
options
)
rescue
StandardError
=>
e
puts
e
ret
=
3
ensure
exit
(
ret
)
end
end
end
namespace
:gen
do
...
...
This diff is collapsed.
Click to expand it.
lib/refrepo/valid/
input/check-network-description
.rb
→
lib/refrepo/valid/
network
.rb
+
2
−
55
View file @
4e3ea3fa
...
...
@@ -20,10 +20,10 @@ def check_network_description(options)
# get list of network equipments and nodes
neteqs
=
[]
nodes
=
[]
Dir
::
glob
(
"
../../
data/grid5000/sites/
#{
site
}
/network_equipments/*.json"
).
each
do
|
f
|
Dir
::
glob
(
"data/grid5000/sites/
#{
site
}
/network_equipments/*.json"
).
each
do
|
f
|
neteqs
<<
JSON
::
parse
(
IO
::
read
(
f
))
end
Dir
::
glob
(
"
../../
data/grid5000/sites/
#{
site
}
/clusters/*/nodes/*.json"
).
each
do
|
f
|
Dir
::
glob
(
"data/grid5000/sites/
#{
site
}
/clusters/*/nodes/*.json"
).
each
do
|
f
|
nodes
<<
JSON
::
parse
(
IO
::
read
(
f
))
end
...
...
@@ -286,56 +286,3 @@ def sh(cmd)
end
return
output
end
if
__FILE__
==
$0
require
'optparse'
options
=
{}
options
[
:sites
]
=
%w{grenoble lille luxembourg lyon nancy nantes rennes sophia}
OptionParser
.
new
do
|
opts
|
opts
.
banner
=
"Usage: check-network-description.rb [options]"
opts
.
separator
""
opts
.
separator
"Example: ruby check-network-description.rb -v"
###
opts
.
separator
""
opts
.
separator
"Filters:"
opts
.
on
(
'-s'
,
'--sites a,b,c'
,
Array
,
'Select site(s)'
,
"Default: "
+
options
[
:sites
].
join
(
", "
))
do
|
s
|
raise
"Wrong argument for -s option."
unless
(
s
-
options
[
:sites
]).
empty?
options
[
:sites
]
=
s
end
opts
.
separator
""
opts
.
separator
"Common options:"
opts
.
on
(
"-v"
,
"--[no-]verbose"
,
"Run verbosely"
)
do
|
v
|
options
[
:verbose
]
||=
0
options
[
:verbose
]
=
options
[
:verbose
]
+
1
end
opts
.
on
(
""
,
"--dot"
,
"Generate one dotfile per site"
)
do
options
[
:dot
]
=
true
end
# Print an options summary.
opts
.
on_tail
(
"-h"
,
"--help"
,
"Show this message"
)
do
puts
opts
exit
end
end
.
parse!
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