Пример #1
0
 def test_get_absolute_resource_path(self):
     full_path = utils.get_absolute_resource_path(
         os.path.join('pm', 'nssm', 'nssm.exe'))
     expected = os.path.join(
         os.path.dirname(cloudify_agent.__file__),
         'resources',
         'pm',
         'nssm',
         'nssm.exe')
     self.assertEqual(expected, full_path)
Пример #2
0
    def __init__(self, logger=None, **params):
        super(NonSuckingServiceManagerDaemon, self).__init__(logger=logger,
                                                             **params)

        self.config_path = os.path.join(self.workdir,
                                        '{0}.conf.bat'.format(self.name))
        self.nssm_path = utils.get_absolute_resource_path(
            os.path.join('pm', 'nssm', 'nssm.exe'))
        self.startup_policy = params.get('startup_policy', 'auto')
        self.failure_reset_timeout = params.get('failure_reset_timeout', 60)
        self.failure_restart_delay = params.get('failure_restart_delay', 5000)
Пример #3
0
    def __init__(self, logger=None, **params):
        super(NonSuckingServiceManagerDaemon, self).__init__(
            logger=logger, **params)

        self.config_path = os.path.join(
            self.workdir,
            '{0}.conf.bat'.format(self.name))
        self.nssm_path = utils.get_absolute_resource_path(
            os.path.join('pm', 'nssm', 'nssm.exe'))
        self.startup_policy = params.get('startup_policy', 'auto')
        self.failure_reset_timeout = params.get('failure_reset_timeout', 60)
        self.failure_restart_delay = params.get('failure_restart_delay', 5000)
Пример #4
0
 def tearDown(self):
     super(BaseDaemonLiveTestCase, self).tearDown()
     if os.name == 'nt':
         # with windows we need to stop and remove the service
         nssm_path = utils.get_absolute_resource_path(
             os.path.join('pm', 'nssm', 'nssm.exe'))
         for daemon in self.daemons:
             self.runner.run('sc stop {0}'.format(daemon.name),
                             exit_on_failure=False)
             self.runner.run('{0} remove {1} confirm'
                             .format(nssm_path, daemon.name),
                             exit_on_failure=False)
     else:
         self.runner.run("pkill -9 -f 'celery'", exit_on_failure=False)
Пример #5
0
def nssm_daemon(tmp_path, agent_ssl_cert):
    daemon = TestNSSMDaemon(tmp_path, logger, agent_ssl_cert)

    yield daemon

    nssm_path = utils.get_absolute_resource_path(
        os.path.join('pm', 'nssm', 'nssm.exe'))
    for _daemon in daemon.daemons:
        daemon.runner.run('sc stop {0}'.format(_daemon.name),
                          exit_on_failure=False)
        daemon.runner.run('{0} remove {1} confirm'.format(
            nssm_path, _daemon.name),
                          exit_on_failure=False)
    for _daemon in daemon.daemons:
        daemon.factory.delete(_daemon.name)
Пример #6
0
 def tearDown(self):
     super(BaseDaemonLiveTestCase, self).tearDown()
     if os.name == 'nt':
         # with windows we need to stop and remove the service
         nssm_path = utils.get_absolute_resource_path(
             os.path.join('pm', 'nssm', 'nssm.exe'))
         for daemon in self.daemons:
             self.runner.run('sc stop {0}'.format(daemon.name),
                             exit_on_failure=False)
             self.runner.run('{0} remove {1} confirm'.format(
                 nssm_path, daemon.name),
                             exit_on_failure=False)
     else:
         self.runner.run("pkill -9 -f 'cloudify_agent.worker'",
                         exit_on_failure=False)
Пример #7
0
def test_get_absolute_resource_path():
    full_path = utils.get_absolute_resource_path(
        os.path.join('pm', 'nssm', 'nssm.exe'))
    expected = os.path.join(os.path.dirname(cloudify_agent.__file__),
                            'resources', 'pm', 'nssm', 'nssm.exe')
    assert expected == full_path
Пример #8
0
#  * See the License for the specific language governing permissions and
#  * limitations under the License.
#

import json
import os
import subprocess
import sys
import tempfile

from cloudify import broker_config
from cloudify import utils
from cloudify.decorators import operation
from cloudify_agent.api.utils import get_absolute_resource_path

NSSM_EXE = get_absolute_resource_path(os.path.join('pm', 'nssm', 'nssm.exe'))
PSUTIL_SERVICE = 'cloudify-psutil'
LOOP_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         'loop.py')


@operation
def start(ctx, psutil_config, **kwargs):
    broker_user, broker_pass = utils.internal.get_broker_credentials(
        ctx.bootstrap_context.cloudify_agent)

    broker_port, ssl_options = utils.internal.get_broker_ssl_and_port(
        ssl_enabled=broker_config.broker_ssl_enabled,
        cert_path=broker_config.broker_cert_path)

    rabbit_config_dict = {
#  * See the License for the specific language governing permissions and
#  * limitations under the License.
#

import json
import os
import subprocess
import sys
import tempfile

from cloudify import broker_config
from cloudify import utils
from cloudify.decorators import operation
from cloudify_agent.api.utils import get_absolute_resource_path

NSSM_EXE = get_absolute_resource_path(os.path.join('pm', 'nssm', 'nssm.exe'))
PSUTIL_SERVICE = 'cloudify-psutil'
LOOP_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         'loop.py')


@operation
def start(ctx, psutil_config, **kwargs):
    broker_user, broker_pass = utils.internal.get_broker_credentials(
            ctx.bootstrap_context.cloudify_agent)

    broker_port, ssl_options = utils.internal.get_broker_ssl_and_port(
            ssl_enabled=broker_config.broker_ssl_enabled,
            cert_path=broker_config.broker_cert_path)

    rabbit_config_dict = {