def parse(self, force=False): if self.parsed and not force: return self.parsed_conf self.parsed_conf = PHPFPMConfig(path=self.conf_path).parsed self.parsed = True return self.parsed_conf
def test_new_format_no_values(self): conf = os.getcwd() + '/test/fixtures/phpfpm/new_format_no_values' \ '/php-fpm.conf' config = PHPFPMConfig(path=conf) assert_that(config, not_none()) assert_that( config.parsed, equal_to({ 'pools': [{ 'status_path': None, 'name': 'www', 'file': '/amplify/test/fixtures/phpfpm/new_format_' 'no_values/php-fpm.d/www.conf', 'listen': '9000' }, { 'status_path': '/php_status', 'name': 'www-socket', 'file': '/amplify/test/fixtures/phpfpm/new_format_' 'no_values/php-fpm.d/www-socket.conf', 'listen': None }], 'include': ['php-fpm.d/*.conf'], 'file': '/amplify/test/fixtures/phpfpm/new_format_no_values' '/php-fpm.conf' }))
def parse(self, force=False): if self.parsed and not force: return self.parsed_conf context.log.debug('parsing phpfpm conf "%s"', self.conf_path) start_time = time.time() self.parsed_conf = PHPFPMConfig(path=self.conf_path).parsed self.parsed = True end_time = time.time() context.log.debug('finished parse of "%s" in %.2f' % (self.conf_path, end_time - start_time)) return self.parsed_conf
def test_new_format_no_include(self): conf = os.getcwd() + '/test/fixtures/phpfpm/new_format_no_include/' \ 'php-fpm.conf' config = PHPFPMConfig(path=conf) assert_that(config, not_none()) assert_that( config.parsed, equal_to({ 'pools': [], 'include': [], 'file': '/amplify/test/fixtures/phpfpm/new_format_no_include' '/php-fpm.conf' }))
def test_new_format(self): conf = os.getcwd() + '/test/fixtures/phpfpm/new_format/php-fpm.conf' config = PHPFPMConfig(path=conf) assert_that(config, not_none()) assert_that( config.parsed, equal_to({ 'pools': [{ 'status_path': '/status', 'name': 'www', 'file': '/amplify/test/fixtures/phpfpm/new_format/' 'php-fpm-7.0.d/www.conf', 'listen': '127.0.0.1:9000' }], 'include': ['php-fpm-7.0.d/*.conf'], 'file': '/amplify/test/fixtures/phpfpm/new_format/php-fpm.conf' }))
def test_old_working_file(self): config = PHPFPMConfig(path='/etc/php5/fpm/php-fpm.conf') assert_that(config, not_none()) assert_that( config.parsed, equal_to({ 'pools': [{ 'status_path': '/status', 'name': 'www', 'file': '/etc/php5/fpm/pool.d/www.conf', 'listen': '/run/php/php7.0-fpm.sock' }, { 'status_path': '/status', 'name': 'www2', 'file': '/etc/php5/fpm/pool.d/www2.conf', 'listen': '127.0.0.1:51' }], 'include': ['/etc/php5/fpm/pool.d/*.conf'], 'file': '/etc/php5/fpm/php-fpm.conf' }))