From 577ed27f1bb060080d311342047e31943a02ccbb Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 18 May 2017 15:05:57 -0400 Subject: PLT-6408 Framework for job server (#6404) * Added initial job server * Added job server to be ran as part of platform * Added test job to the enterprise repo * Fixed job server not loading license * Renamed job package to jobs * Fixed TE not being buildable * Added JobStatus table to database * Changed fields used by JobStatus * Added APIs to query job status * Added config change listener to server * Added option to run job server from Makefile * Added ability to enable/disable jobs from config * Commented out placeholder for search indexing job * Fixed govet * Removed debug messages and fixed job api init message --- app/license.go | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'app/license.go') diff --git a/app/license.go b/app/license.go index 7a00d7fb4..44b700d5b 100644 --- a/app/license.go +++ b/app/license.go @@ -4,7 +4,6 @@ package app import ( - "os" "strings" l4g "github.com/alecthomas/log4go" @@ -23,28 +22,14 @@ func LoadLicense() { if len(licenseId) != 26 { // Lets attempt to load the file from disk since it was missing from the DB - fileName := utils.GetLicenseFileLocation(*utils.Cfg.ServiceSettings.LicenseFileLocation) - - if _, err := os.Stat(fileName); err == nil { - l4g.Info("License key has not been uploaded. Loading license key from disk at %v", fileName) - licenseBytes := utils.GetLicenseFileFromDisk(fileName) - - if success, licenseStr := utils.ValidateLicense(licenseBytes); success { - licenseFileFromDisk := model.LicenseFromJson(strings.NewReader(licenseStr)) - licenseId = licenseFileFromDisk.Id - if _, err := SaveLicense(licenseBytes); err != nil { - l4g.Info("Failed to save license key loaded from disk err=%v", err.Error()) - return - } + license, licenseBytes := utils.GetAndValidateLicenseFileFromDisk() + + if license != nil { + if _, err := SaveLicense(licenseBytes); err != nil { + l4g.Info("Failed to save license key loaded from disk err=%v", err.Error()) } else { - l4g.Error("Found license key at %v but it appears to be invalid.", fileName) - return + licenseId = license.Id } - - } else { - l4g.Info(utils.T("mattermost.load_license.find.warn")) - l4g.Debug("We could not find the license key in the database or on disk at %v", fileName) - return } } -- cgit v1.2.3-1-g7c22