@@ -242,9 +242,9 @@ def valid_ip(ipstr):
242242 rcfile = open (rclocal ,"a" )
243243 startstr = "\n # Start %s ip %s." % (options .suffix , str (datetime .now ()))
244244 if options .debug :
245- print startstr
245+ print startstr ,
246246 else :
247- print startstr
247+ print startstr ,
248248 rcfile .write (startstr )
249249
250250 for key in ips :
@@ -263,12 +263,12 @@ def valid_ip(ipstr):
263263 LOG .error ("%s is not a valid ip." , newip )
264264 sys .exit (RET_FAILED )
265265
266- ifcmd = "ifconfig %s:%s %s network %s up" % (key , options .suffix , newip , mask )
266+ ifcmd = "ifconfig %s:%s %s netmask %s up \n " % (key , options .suffix , newip , mask )
267267 routecmd = ""
268268 subgateway = ""
269269 if key .startswith ("lo:" ):
270- ifcmd = "ifconfig %s:%s %s broadcast %s netmask %s up" % (key , options .suffix , newip , newip , mask )
271- routecmd = "route add -host %s dev %s:%s" % (newip , key , options .suffix )
270+ ifcmd = "ifconfig %s:%s %s broadcast %s netmask %s up \n " % (key , options .suffix , newip , newip , mask )
271+ routecmd = "route add -host %s dev %s:%s \n " % (newip , key , options .suffix )
272272 else :
273273 if "default" in gateways .keys ():
274274 subgateway = gateways ["default" ].replace (args [0 ], args [1 ])
@@ -278,14 +278,14 @@ def valid_ip(ipstr):
278278 if subgateway == "" :
279279 LOG .error ("gateway is empty in add ip: %s" , ip )
280280 sys .exit (RET_FAILED )
281- routecmd = "ip r a 11.0.0.0/8 via %s" % (subgateway )
281+ routecmd = "ip r a 11.0.0.0/8 via %s \n " % (subgateway )
282282
283283 if options .debug :
284- print ifcmd
285- print routecmd
284+ print ifcmd ,
285+ print routecmd ,
286286 else :
287- print "run:" , ifcmd
288- print "run:" , routecmd
287+ print "run:" , ifcmd ,
288+ print "run:" , routecmd ,
289289
290290 ret , output , errout = exec_cmd_with_stderr (ifcmd )
291291 if ret != 0 :
@@ -301,9 +301,9 @@ def valid_ip(ipstr):
301301
302302 endstr = "# End %s ip.\n " % (options .suffix )
303303 if options .debug :
304- print endstr
304+ print endstr ,
305305 else :
306- print endstr
306+ print endstr ,
307307 rcfile .write (endstr )
308308
309309 if rcfile :
0 commit comments