bug fix: fetch buckets

This commit is contained in:
Usman Nasir
2020-12-25 14:18:47 +05:00
parent 9920b52750
commit 40708e90b9
3 changed files with 31 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.db import models from django.db import models
from websiteFunctions.models import Websites
# Create your models here. # Create your models here.
class WPDeployments(models.Model):
owner = models.ForeignKey(Websites, on_delete=models.CASCADE)
config = models.TextField()

View File

@@ -476,6 +476,7 @@ $parameters = array(
adminPassword = self.extraArgs['adminPassword'] adminPassword = self.extraArgs['adminPassword']
adminEmail = self.extraArgs['adminEmail'] adminEmail = self.extraArgs['adminEmail']
FNULL = open(os.devnull, 'w') FNULL = open(os.devnull, 'w')
### Check WP CLI ### Check WP CLI
@@ -520,7 +521,8 @@ $parameters = array(
dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website.master) dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website.master)
self.permPath = website.path self.permPath = website.path
except: except BaseException as msg:
website = Websites.objects.get(domain=domainName) website = Websites.objects.get(domain=domainName)
externalApp = website.externalApp externalApp = website.externalApp
self.masterDomain = website.domain self.masterDomain = website.domain
@@ -543,6 +545,7 @@ $parameters = array(
dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website) dbName, dbUser, dbPassword = self.dbCreation(tempStatusPath, website)
self.permPath = '/home/%s/public_html' % (website.domain) self.permPath = '/home/%s/public_html' % (website.domain)
## Security Check ## Security Check
command = 'chmod 755 %s' % (self.permPath) command = 'chmod 755 %s' % (self.permPath)
@@ -568,7 +571,7 @@ $parameters = array(
try: try:
command = "wp core download --allow-root --path=%s --version=%s" % (finalPath, self.extraArgs['version']) command = "wp core download --allow-root --path=%s --version=%s" % (finalPath, self.extraArgs['version'])
except BaseException as msg: except:
command = "wp core download --allow-root --path=" + finalPath command = "wp core download --allow-root --path=" + finalPath
ProcessUtilities.executioner(command, externalApp) ProcessUtilities.executioner(command, externalApp)
@@ -607,6 +610,7 @@ $parameters = array(
command = "wp plugin activate litespeed-cache --allow-root --path=" + finalPath command = "wp plugin activate litespeed-cache --allow-root --path=" + finalPath
ProcessUtilities.executioner(command, externalApp) ProcessUtilities.executioner(command, externalApp)
## ##
from filemanager.filemanager import FileManager from filemanager.filemanager import FileManager
@@ -1251,6 +1255,25 @@ $parameters = array(
self.extraArgs['tempStatusPath'] = currentTemp self.extraArgs['tempStatusPath'] = currentTemp
### Save config in db
from cloudAPI.models import WPDeployments
from websiteFunctions.models import Websites
import json
website = Websites.objects.get(domain = self.extraArgs['domain'])
del self.extraArgs['adminPassword']
del self.extraArgs['password']
del self.extraArgs['tempStatusPath']
del self.extraArgs['domain']
del self.extraArgs['adminEmail']
del self.extraArgs['adminUser']
del self.extraArgs['blogTitle']
wpDeploy = WPDeployments(owner=website, config=json.dumps(self.extraArgs))
wpDeploy.save()
logging.statusWriter(self.extraArgs['tempStatusPath'], 'Completed [200].') logging.statusWriter(self.extraArgs['tempStatusPath'], 'Completed [200].')
except BaseException as msg: except BaseException as msg:
@@ -1290,10 +1313,10 @@ def main():
extraArgs['userName'] = args.userName extraArgs['userName'] = args.userName
extraArgs['version'] = args.version extraArgs['version'] = args.version
try: if args.path != None:
extraArgs['path'] = args.path extraArgs['path'] = args.path
extraArgs['home'] = '0' extraArgs['home'] = '0'
except: else:
extraArgs['home'] = '1' extraArgs['home'] = '1'
ai = ApplicationInstaller(None, extraArgs) ai = ApplicationInstaller(None, extraArgs)

View File

@@ -158,7 +158,6 @@ class S3Backups(multi.Thread):
aws_access_key_id=aws_access_key_id, aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key, aws_secret_access_key=aws_secret_access_key,
endpoint_url=region, endpoint_url=region,
config=Config(signature_version='v4')
) )
else: else:
s3 = boto3.resource( s3 = boto3.resource(