Move variable wo_wan and change variable distro

This commit is contained in:
VirtuBox
2019-07-30 14:32:23 +02:00
parent 23bc63364d
commit 05fc7ba161
4 changed files with 21 additions and 23 deletions

View File

@@ -97,7 +97,7 @@ class WOStackController(CementBaseController):
if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
# add mariadb repository excepted on raspbian and ubuntu 19.04
if (not WOVariables.wo_platform_distro == 'raspbian'):
if (not WOVariables.wo_distro == 'raspbian'):
Log.info(self, "Adding repository for MySQL, please wait...")
mysql_pref = ("Package: *\nPin: origin "
"sfo1.mirrors.digitalocean.com"
@@ -115,7 +115,7 @@ class WOStackController(CementBaseController):
# generate random 24 characters root password
chars = ''.join(random.sample(string.ascii_letters, 24))
# configure MySQL non-interactive install
if (not WOVariables.wo_platform_distro == 'raspbian'):
if (not WOVariables.wo_distro == 'raspbian'):
Log.debug(self, "Pre-seeding MySQL")
Log.debug(self, "echo \"mariadb-server-10.3 "
"mysql-server/root_password "
@@ -196,7 +196,7 @@ class WOStackController(CementBaseController):
# add nginx repository
if set(WOVariables.wo_nginx).issubset(set(apt_packages)):
if (WOVariables.wo_platform_distro == 'ubuntu'):
if (WOVariables.wo_distro == 'ubuntu'):
Log.info(self, "Adding repository for NGINX, please wait...")
WORepo.add(self, ppa=WOVariables.wo_nginx_repo)
Log.debug(self, 'Adding ppa for Nginx')
@@ -209,7 +209,7 @@ class WOStackController(CementBaseController):
# add php repository
if (set(WOVariables.wo_php73).issubset(set(apt_packages)) or
set(WOVariables.wo_php).issubset(set(apt_packages))):
if (WOVariables.wo_platform_distro == 'ubuntu'):
if (WOVariables.wo_distro == 'ubuntu'):
Log.info(self, "Adding repository for PHP, please wait...")
Log.debug(self, 'Adding ppa for PHP')
WORepo.add(self, ppa=WOVariables.wo_php_repo)
@@ -230,7 +230,7 @@ class WOStackController(CementBaseController):
# add redis repository
if set(WOVariables.wo_redis).issubset(set(apt_packages)):
Log.info(self, "Adding repository for Redis, please wait...")
if WOVariables.wo_platform_distro == 'ubuntu':
if WOVariables.wo_distro == 'ubuntu':
Log.debug(self, 'Adding ppa for redis')
WORepo.add(self, ppa=WOVariables.wo_redis_repo)
else:
@@ -1234,12 +1234,17 @@ class WOStackController(CementBaseController):
'wo-dashboard.tar.gz',
'{0}22222/htdocs'
.format(WOVariables.wo_webroot))
wo_wan = os.popen("/sbin/ip -4 route get 8.8.8.8 | "
"grep -oP \"dev [^[:space:]]+ \" "
"| cut -d ' ' -f 2").read()
if wo_wan == '':
wo_wan = 'eth0'
if WOVariables.wo_wan != 'eth0':
WOFileUtils.searchreplace(self, "{0}22222/htdocs/index.php"
WOFileUtils.searchreplace(self,
"{0}22222/htdocs/index.php"
.format(WOVariables.wo_webroot),
"eth0",
"{0}".format(WOVariables.wo_wan))
Log.debug(self, "Setting Privileges to "
"{0}22222/htdocs"
.format(WOVariables.wo_webroot))

View File

@@ -49,7 +49,7 @@ class WOStackUpgradeController(CementBaseController):
@expose(hide=True)
def upgrade_php56(self):
if WOVariables.wo_platform_distro == "ubuntu":
if WOVariables.wo_distro == "ubuntu":
if os.path.isfile("/etc/apt/sources.list.d/ondrej-php5-5_6-{0}."
"list".format(WOVariables.wo_platform_codename)):
Log.error(self, "Unable to find PHP 5.5")
@@ -68,7 +68,7 @@ class WOStackUpgradeController(CementBaseController):
if start_upgrade != "Y" and start_upgrade != "y":
Log.error(self, "Not starting PHP package update")
if WOVariables.wo_platform_distro == "ubuntu":
if WOVariables.wo_distro == "ubuntu":
WORepo.remove(self, ppa="ppa:ondrej/php5")
WORepo.add(self, ppa=WOVariables.wo_php_repo)

View File

@@ -12,7 +12,7 @@ def check_fqdn(self, wo_host):
WOShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts"
.format(wo_host))
if WOVariables.wo_platform_distro == 'debian':
if WOVariables.wo_distro == 'debian':
WOShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start")
else:
WOShellExec.cmd_exec(self, "service hostname restart")

View File

@@ -20,18 +20,11 @@ class WOVariables():
# Get WPCLI path
wo_wpcli_path = '/usr/local/bin/wp'
# get wan network interface name
wo_wan = os.popen("/sbin/ip -4 route get 8.8.8.8 | "
"grep -oP \"dev [^[:space:]]+ \" "
"| cut -d ' ' -f 2").read()
if wo_wan == '':
wo_wan = 'eth0'
# Current date and time of System
wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S')
# WordOps core variables
wo_platform_distro = os.popen("/usr/bin/lsb_release -si "
wo_distro = os.popen("/usr/bin/lsb_release -si "
"| tr -d \'\\n\'").read().lower()
wo_platform_version = platform.linux_distribution()[1]
wo_platform_codename = os.popen(
@@ -91,14 +84,14 @@ class WOVariables():
# WordOps stack installation variables
# Nginx repo and packages
if wo_platform_distro == 'ubuntu':
if wo_distro == 'ubuntu':
if wo_platform_codename == 'trusty':
wo_nginx_repo = ("deb http://download.opensuse.org"
"/repositories/home:"
"/virtubox:/WordOps/xUbuntu_14.04/ /")
else:
wo_nginx_repo = "ppa:wordops/nginx-wo"
elif wo_platform_distro == 'debian':
elif wo_distro == 'debian':
if wo_platform_codename == 'jessie':
wo_nginx_repo = ("deb http://download.opensuse.org"
"/repositories/home:"
@@ -119,7 +112,7 @@ class WOVariables():
wo_nginx_key = '188C9FB063F0247A'
# PHP repo and packages
if wo_platform_distro == 'ubuntu':
if wo_distro == 'ubuntu':
wo_php_repo = "ppa:ondrej/php"
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
"php7.2-readline", "php7.2-common", "php7.2-recode",
@@ -155,7 +148,7 @@ class WOVariables():
wo_php_key = 'AC0E47584A7A714D'
# MySQL repo and packages
if wo_platform_distro == 'ubuntu':
if wo_distro == 'ubuntu':
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
"http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
"10.3/ubuntu {codename} main"
@@ -170,7 +163,7 @@ class WOVariables():
wo_fail2ban = ["fail2ban"]
# Redis repo details
if wo_platform_distro == 'ubuntu':
if wo_distro == 'ubuntu':
wo_redis_repo = ("ppa:chris-lea/redis-server")
else: