summaryrefslogtreecommitdiffstats
path: root/deploy/adapters
diff options
context:
space:
mode:
authorJustin chi <chigang@huawei.com>2017-03-27 10:15:03 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-03-27 10:15:03 +0000
commite5087aeecc7649437aa0e4e8664e77b17b3a2c11 (patch)
tree90c35023b9ca9cb4f88f2b5f99e698cddb6ef5ee /deploy/adapters
parent751fe977da4661d7c99733afc7d0b1d060da198d (diff)
parentfa51e57bede51900e107daf7436f1f1f3c620df3 (diff)
Merge "Support compute node restart on CentOS"
Diffstat (limited to 'deploy/adapters')
-rw-r--r--deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
index ab13e088..64c0469e 100644
--- a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
+++ b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
@@ -10,6 +10,8 @@
import yaml
import netaddr
import os
+import platform
+import re
import log as logging
LOG = logging.getLogger("net-init")
@@ -88,6 +90,11 @@ def main(config):
setup_ips(config["ip_settings"], config["sys_intf_mappings"])
if __name__ == "__main__":
- os.system("service openvswitch-switch status|| service openvswitch-switch start") # noqa
+ if re.search('Ubuntu', platform.platform()):
+ os.system("service openvswitch-switch start")
+ elif re.search('redhat|centos', platform.platform()):
+ os.system("service openvswitch start")
+ else:
+ os.system("echo 'ERROR: no service named openvswitch'")
config = yaml.load(open(config_path))
main(config)