Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
hostinfo
Commits
fd714bc7
Commit
fd714bc7
authored
Aug 15, 2017
by
Anders Blomdell
Browse files
Add comment on who generated ifcfg-*
parent
aa2e68b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/hostinfo/ifconfig.py
View file @
fd714bc7
...
...
@@ -2,6 +2,7 @@ import hostinfo.util as util
import
subprocess
import
re
import
ipaddr
import
sys
def
get_nm_extra
(
device
):
result
=
""
...
...
@@ -222,7 +223,8 @@ def generate(tree, host):
continue
device_name
=
device
(
i
.
ethernet
[
0
])
if
i
.
bridge
[
0
]:
config
=
'DEVICE=%s
\n
'
%
i
.
bridge
[
0
]
config
=
'# Generated by %s
\n
'
%
(
' '
.
join
(
sys
.
argv
))
config
+=
'DEVICE=%s
\n
'
%
i
.
bridge
[
0
]
config
+=
'NAME="%s"
\n
'
%
i
.
bridge
[
0
]
config
+=
'ONBOOT=yes
\n
'
config
+=
'TYPE=Bridge
\n
'
...
...
@@ -231,7 +233,8 @@ def generate(tree, host):
config
+=
generate_ifcfg
(
tree
,
i
)
result
.
append
((
'ifcfg-%s'
%
i
.
bridge
[
0
],
config
))
config
=
'DEVICE=%s
\n
'
%
device_name
config
=
'# Generated by %s
\n
'
%
(
' '
.
join
(
sys
.
argv
))
config
+=
'DEVICE=%s
\n
'
%
device_name
config
+=
'NAME="%s"
\n
'
%
device_name
config
+=
'HWADDR=%s
\n
'
%
i
.
ethernet
[
0
].
upper
()
config
+=
'ONBOOT=yes
\n
'
...
...
@@ -241,7 +244,8 @@ def generate(tree, host):
result
.
append
((
'ifcfg-%s'
%
device_name
,
config
))
pass
elif
i
.
ethernet
[
0
]:
config
=
'DEVICE=%s
\n
'
%
device_name
config
=
'# Generated by %s
\n
'
%
(
' '
.
join
(
sys
.
argv
))
config
+=
'DEVICE=%s
\n
'
%
device_name
config
+=
'NAME="%s"
\n
'
%
device_name
config
+=
'HWADDR=%s
\n
'
%
i
.
ethernet
[
0
].
upper
()
config
+=
'ONBOOT=yes
\n
'
...
...
Write
Preview
Supports
Markdown
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