diff --git a/CHANGELOG.md b/CHANGELOG.md index c06fb09..914b470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### v3.9.x - [Unreleased] -#### Changed +#### Fixed -- Install ngxblocker with Nginx to set proper values for variables_hash_bucket_size & variables_hash_max_size without conflicts +- Issue with Nginx variables_hash_bucket_size & variables_hash_max_size ### v3.11.1 - 2019-12-04 diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index f6a29d7..8237572 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -321,9 +321,15 @@ def post_pref(self, apt_packages, packages, upgrade=False): "'\"$http_referer\" " "\"$http_user_agent\"';\n") - # Nginx-Plus does not have nginx - # package structure like this - # So creating directories + if not os.path.exists('/etc/nginx/bots.d'): + WOFileUtils.textwrite( + self, '/etc/nginx/conf.d/variables-hash.conf', + 'variables_hash_max_size 4096;\n' + 'variables_hash_bucket_size 4096;') + + # Nginx-Plus does not have nginx + # package structure like this + # So creating directories if not os.path.exists('/etc/nginx/sites-available'): Log.debug(self, 'Creating directory' '/etc/nginx/sites-available') @@ -1585,11 +1591,16 @@ def post_pref(self, apt_packages, packages, upgrade=False): # ngxblocker if any('/usr/local/sbin/install-ngxblocker' == x[1] for x in packages): + # remove duplicate directives + if os.path.exists('/etc/nginx/conf.d/variables-hash.conf'): + WOFileUtils.rm(self, '/etc/nginx/conf.d/variables-hash.conf') WOFileUtils.chmod( self, "/usr/local/sbin/install-ngxblocker", 0o700) WOShellExec.cmd_exec(self, '/usr/local/sbin/install-ngxblocker -x') WOFileUtils.chmod( self, "/usr/local/sbin/update-ngxblocker", 0o700) + if not WOService.restart_service(self, 'nginx'): + Log.error(self, 'ngxblocker install failed') def pre_stack(self): diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index 2d8592c..be669c5 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -269,8 +269,6 @@ class WOStackUpgradeController(CementBaseController): '/usr/local/sbin/update-ngxblocker', 'ngxblocker' ]] - else: - Log.info(self, "ngxblocker is not installed") if ((not (apt_packages)) and (not(packages))): self.app.args.print_help() @@ -347,6 +345,9 @@ class WOStackUpgradeController(CementBaseController): WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775) if WOAptGet.is_selected(self, 'ngxblocker', packages): + if os.path.exists('/etc/nginx/conf.d/variables-hash.conf'): + WOFileUtils.rm( + self, '/etc/nginx/conf.d/variables-hash.conf') WOFileUtils.chmod( self, '/usr/local/sbin/update-ngxblocker', 0o775) WOShellExec.cmd_exec(