Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a165dfb6
authored
Oct 25, 2014
by
IK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix centos 7 support
parent
951f3833
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
linux/network.py
+7
-1
No files found.
linux/network.py
View file @
a165dfb6
...
...
@@ -106,12 +106,17 @@ def change_ip_ubuntu(interfaces, dns):
def
change_ip_rhel
(
interfaces
,
dns
):
for
ifname
,
conf
in
get_interfaces_linux
(
interfaces
):
subprocess
.
call
((
'/sbin/ifdown'
,
ifname
))
subprocess
.
call
((
'/sbin/ip'
,
'addr'
,
'flush'
,
'dev'
,
ifname
))
subprocess
.
call
((
'/sbin/ip'
,
'link'
,
'set'
,
'dev'
,
ifname
,
'down'
))
with
open
(
ifcfg_template
%
ifname
,
'w'
)
as
f
:
f
.
write
(
'DEVICE=
%
s
\n
'
'DNS1=
%
s
\n
'
'BOOTPROTO=none
\n
'
'NM_CONTROLLED=no
\n
'
'USERCTL=no
\n
'
'ONBOOT=yes
\n
'
%
ifname
)
'ONBOOT=yes
\n
'
%
(
ifname
,
dns
)
)
for
i
in
conf
[
'addresses'
]:
ip_with_prefix
=
IPNetwork
(
i
)
ip
=
ip_with_prefix
.
ip
...
...
@@ -129,3 +134,4 @@ def change_ip_rhel(interfaces, dns):
'ip'
:
ip
,
'netmask'
:
str
(
ip_with_prefix
.
netmask
),
'gw'
:
conf
[
'gw4'
]})
subprocess
.
call
((
'/sbin/ifup'
,
ifname
))
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