VR CsAddress fixes:

* cleanup imports,
* fix to_str(),
* improve & fix service post_config logic
* don't arpPing when there's no gateway
This commit is contained in:
Ronald van Zantvoort 2016-05-13 17:28:39 +02:00 committed by Wido den Hollander
parent 6055ed6ed6
commit d14a484374

View File

@ -15,15 +15,13 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from CsDatabag import CsDataBag, CsCmdLine
from CsApp import CsApache, CsDnsmasq, CsPasswdSvc
import CsHelper
import logging
from netaddr import IPAddress, IPNetwork
import CsHelper
import subprocess
import time
import CsHelper
from CsDatabag import CsDataBag
from CsApp import CsApache, CsDnsmasq, CsPasswdSvc
from CsRoute import CsRoute
from CsRule import CsRule
@ -198,7 +196,7 @@ class CsInterface:
return self.get_attr("add")
def to_str(self):
pprint(self.address)
return self.address
class CsDevice:
@ -293,8 +291,9 @@ class CsIP:
interfaces = [CsInterface(address, self.config)]
CsHelper.reconfigure_interfaces(self.cl, interfaces)
self.set_mark()
if 'gateway' in self.address:
self.arpPing()
CsRpsrfs(self.dev).enable()
@ -514,14 +513,17 @@ class CsIP:
self.fw_vpcrouter()
# On deletion nw_type will no longer be known
if self.get_type() in ["guest"] and self.config.is_vpc():
if self.get_type() in ('guest'):
if self.config.is_vpc() or self.config.is_router():
CsDevice(self.dev, self.config).configure_rp()
logging.error(
"Not able to setup source-nat for a regular router yet")
if self.config.has_dns() or self.config.is_dhcp():
dns = CsDnsmasq(self)
dns.add_firewall_rules()
if self.config.has_metadata():
app = CsApache(self)
app.setup()
@ -685,3 +687,4 @@ class CsRpsrfs:
if count < 2:
logging.debug("Single CPU machine")
return count