diff options
author | asteroide <thomas.duval@orange.com> | 2017-07-25 18:18:05 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-07-25 18:18:05 +0200 |
commit | c6cbfea94f51536b11e46bfe7053e1fb96c0a968 (patch) | |
tree | f16d7876fda1622e629dee16b481f524a7dbf459 /moonv4/moon_orchestrator/moon_orchestrator/security_policy.py | |
parent | 8c643f53acb79153ab93b2e6fee8bad301af869f (diff) |
Containerize the orchestrator and all components
Change-Id: I9234c3d286e0a273c878bbac66efcd9696490900
Diffstat (limited to 'moonv4/moon_orchestrator/moon_orchestrator/security_policy.py')
-rw-r--r-- | moonv4/moon_orchestrator/moon_orchestrator/security_policy.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/moonv4/moon_orchestrator/moon_orchestrator/security_policy.py b/moonv4/moon_orchestrator/moon_orchestrator/security_policy.py deleted file mode 100644 index 5cb1d51c..00000000 --- a/moonv4/moon_orchestrator/moon_orchestrator/security_policy.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors -# This software is distributed under the terms and conditions of the 'Apache-2.0' -# license which can be found in the file 'LICENSE' in this package distribution -# or at 'http://www.apache.org/licenses/LICENSE-2.0'. - -import os -import time -from oslo_config import cfg -from oslo_log import log as logging -import oslo_messaging -from moon_orchestrator.dockers import DockerBase - -LOG = logging.getLogger(__name__) -CONF = cfg.CONF -DOMAIN = "moon_orchestrator" - -__CWD__ = os.path.dirname(os.path.abspath(__file__)) -# TODO (dthom): select the right template folder -TEMPLATES_FOLDER = os.path.join(__CWD__, "..", "conf", "dockers") - - -class SecurityPolicy(DockerBase): - - id = "moon_secpolicy" - __build = """RUN mkdir -p /etc/moon/ -COPY conf /etc/moon/ -ADD dist/{py_pkg}.tar.gz /root -WORKDIR /root/{py_pkg} -RUN pip3 install -r requirements.txt -RUN pip3 install . -""" - - def __init__(self, intra_extension_id, conf_file="", docker=None, network_config=None): - self.id = "moon_secpolicy" + intra_extension_id - super(SecurityPolicy, self).__init__( - name="moon_secpolicy", - run_cmd=["python3", "-m", "moon_secpolicy", intra_extension_id], - conf_file=conf_file, - docker=docker, - network_config=network_config, - build_cmd=self.__build, - id="moon_secpolicy_{}".format(intra_extension_id), - tag=CONF.security_policy.container - ) - # note(asteroide): time to let the new docker boot - time.sleep(3) - self.get_status() - - def get_status(self): - transport = oslo_messaging.get_transport(CONF) - target = oslo_messaging.Target(topic=self.id, version='1.0') - client = oslo_messaging.RPCClient(transport, target) - LOG.info("Calling Status on {}".format(self.id)) - ret = client.call({"component_id": self.id}, 'get_status', args=None) - LOG.info(ret) - return ret |