diff options
Diffstat (limited to 'deploy/adapters')
-rw-r--r-- | deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py | 9 |
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) |