Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grid5000
reference-repository
Commits
2c89ce9d
Commit
2c89ce9d
authored
Apr 20, 2016
by
Jérémie Gaidamour
Browse files
[dev] bind.rb
parent
bb12975f
Changes
1
Hide whitespace changes
Inline
Side-by-side
dev/puppet/bind.rb
View file @
2c89ce9d
...
...
@@ -17,26 +17,38 @@ $output_dir = ENV['puppet_repo'] || 'output'
# :ip=>"172.16.66",
# :shift=>0,
# :mounted=>true}
def
print_entry
(
entry
)
if
entry
[
:start
]
==
entry
[
:end
]
return
"
#{
entry
[
:cluster_uid
]
}
-
#{
entry
[
:start
]
}
-
#{
entry
[
:net_uid
]
}
IN A
#{
entry
[
:ip
]
}
.
#{
entry
[
:start
]
+
entry
[
:shift
]
}
"
else
range
=
"
#{
entry
[
:start
]
}
-
#{
entry
[
:end
]
}
"
shift
=
(
entry
[
:shift
]
>
0
?
'{+'
+
entry
[
:shift
].
to_s
+
'}'
:
''
)
ip
=
"
#{
entry
[
:ip
]
}
.$
#{
shift
}
"
range
=
""
hostshort
=
"
#{
entry
[
:cluster_uid
]
}
-
#{
entry
[
:start
]
}
"
ip
=
"
#{
entry
[
:ip
]
}
.
#{
entry
[
:start
]
+
entry
[
:shift
]
}
"
else
range
=
"$GENERATE
#{
entry
[
:start
]
}
-
#{
entry
[
:end
]
}
"
# $GENERATE 1-16
hostshort
=
"
#{
entry
[
:cluster_uid
]
}
-$"
# graoully-$
shift
=
(
entry
[
:shift
]
>
0
?
'{+'
+
entry
[
:shift
].
to_s
+
'}'
:
''
)
ip
=
"
#{
entry
[
:ip
]
}
.$
#{
shift
}
"
# 172.16.70.$
end
if
entry
[
:mounted
]
&&
/^eth[0-9]$/
.
match
(
entry
[
:net_uid
])
# primary interface
return
[
"$GENERATE
#{
range
}
#{
entry
[
:cluster_uid
]
}
-$ IN A
#{
ip
}
"
,
"$GENERATE
#{
range
}
#{
entry
[
:cluster_uid
]
}
-$-
#{
entry
[
:net_uid
]
}
IN CNAME
#{
entry
[
:cluster_uid
]
}
-$"
].
join
(
"
\n
"
)
elsif
/^kavlan-[0-9]*$/
.
match
(
entry
[
:net_uid
])
return
[
"$GENERATE
#{
range
}
#{
entry
[
:cluster_uid
]
}
-$-eth0-
#{
entry
[
:net_uid
]
}
IN A
#{
ip
}
"
,
"$GENERATE
#{
range
}
#{
entry
[
:cluster_uid
]
}
-$-
#{
entry
[
:net_uid
]
}
IN CNAME
#{
entry
[
:cluster_uid
]
}
-$-eth0-
#{
entry
[
:net_uid
]
}
"
].
join
(
"
\n
"
)
else
return
"$GENERATE
#{
range
}
#{
entry
[
:cluster_uid
]
}
-$-
#{
entry
[
:net_uid
]
}
IN A
#{
ip
}
"
end
hostalias
=
nil
if
entry
[
:mounted
]
&&
/^eth[0-9]$/
.
match
(
entry
[
:net_uid
])
# primary interface
hostalias
=
hostshort
elsif
/^kavlan-[0-9]*$/
.
match
(
entry
[
:net_uid
])
# kvlan
hostalias
=
hostshort
+
"-eth0-
#{
entry
[
:net_uid
]
}
"
# graoully-$-eth0-kavlan-1
end
hostname
=
hostshort
+
"-
#{
entry
[
:net_uid
]
}
"
# graoully-$-eth0
if
hostalias
return
[
"
#{
range
}#{
hostalias
}
IN A
#{
ip
}
"
,
"
#{
range
}#{
hostname
}
IN CNAME
#{
hostalias
}
"
].
join
(
"
\n
"
)
else
return
"
#{
range
}#{
hostname
}
IN A
#{
ip
}
"
end
end
# def write_bind_file(data)
...
...
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