How to use the amplify.agent.objects.nginx.binary.get_prefix_and_conf_path function in amplify

To help you get started, we’ve selected a few amplify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_1111_absolute(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx -p /var -c /etc/nginx.conf', {'prefix': '/var', 'conf-path': '/foo/nginx.conf'}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/var'))
        assert_that(conf_path, equal_to('/etc/nginx.conf'))
github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_0101_absolute(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx -p /var', {'conf-path': '/etc/nginx.conf'}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/var'))
        assert_that(conf_path, equal_to('/etc/nginx.conf'))
github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_0011_relative(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx', {'prefix': '/var', 'conf-path': 'dir/nginx.conf'}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/var'))
        assert_that(conf_path, equal_to('/var/dir/nginx.conf'))
github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_1011_relative(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx -c dir/nginx.conf', {'prefix': '/var', 'conf-path': '/foo/nginx.conf'}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/var'))
        assert_that(conf_path, equal_to('/var/dir/nginx.conf'))
github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_1000_relative(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx -c dir/nginx.conf', {}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/usr/local/nginx'))
        assert_that(conf_path, equal_to('/usr/local/nginx/dir/nginx.conf'))
github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_1100_absolute(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx -p /var -c /etc/nginx.conf', {}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/var'))
        assert_that(conf_path, equal_to('/etc/nginx.conf'))
github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_0110(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx -p /var', {'prefix': '/foo'}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/var'))
        assert_that(conf_path, equal_to('/var/conf/nginx.conf'))
github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_0001_relative(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx', {'conf-path': 'dir/nginx.conf'}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/usr/local/nginx'))
        assert_that(conf_path, equal_to('/usr/local/nginx/dir/nginx.conf'))
github nginxinc / nginx-amplify-agent / test / unit / agent / objects / nginx / binary.py View on Github external
def test_1100_relative(self):
        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(
            'nginx: master process nginx -p /var -c dir/nginx.conf', {}
        )
        assert_that(bin_path, equal_to('nginx'))
        assert_that(prefix, equal_to('/var'))
        assert_that(conf_path, equal_to('/var/dir/nginx.conf'))
github nginxinc / nginx-amplify-agent / amplify / agent / managers / nginx.py View on Github external
gwe = re.match(r'\s*(?P\d+)\s+(?P\d+)\s+(?P.+)\s*', line)

                # if not parsed - go to the next line
                if not gwe:
                    continue

                pid, ppid, cmd = int(gwe.group('pid')), int(gwe.group('ppid')), gwe.group('cmd').rstrip()

                # match nginx master process
                if 'nginx: master process' in cmd:
                    if not launch_method_supported("nginx", ppid):
                        continue

                    # get path to binary, prefix and conf_path
                    try:
                        bin_path, prefix, conf_path, version = get_prefix_and_conf_path(cmd)
                    except:
                        context.log.debug('failed to find bin_path, prefix and conf_path for %s' % cmd)
                        context.log.debug('', exc_info=True)
                    else:
                        # calculate local id
                        local_id = hashlib.sha256('%s_%s_%s' % (bin_path, conf_path, prefix)).hexdigest()

                        if pid not in masters:
                            masters[pid] = {'workers': []}

                        masters[pid].update({
                            'version': version,
                            'bin_path': bin_path,
                            'conf_path': conf_path,
                            'prefix': prefix,
                            'pid': pid,