-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
697fa5f
commit 09ceb52
Showing
29 changed files
with
4,045 additions
and
4,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
package xdbutil | ||
|
||
import ( | ||
"os" | ||
|
||
trcdb "github.com/trimble-oss/tierceron/atrium/trcdb" | ||
"github.com/trimble-oss/tierceron/pkg/trcx/xutil" | ||
eUtils "github.com/trimble-oss/tierceron/pkg/utils" | ||
) | ||
|
||
// GenerateSeedsFromVaultToDb pulls all data from vault for each template into a database | ||
func GenerateSeedsFromVaultToDb(driverConfig *eUtils.DriverConfig) (interface{}, error) { | ||
if driverConfig.Diff { //Clean flag in trcx | ||
_, err1 := os.Stat(driverConfig.EndDir + driverConfig.Env) | ||
err := os.RemoveAll(driverConfig.EndDir + driverConfig.Env) | ||
|
||
if err != nil { | ||
eUtils.LogErrorObject(&driverConfig.CoreConfig, err, false) | ||
return nil, err | ||
} | ||
|
||
if err1 == nil { | ||
eUtils.LogInfo(&driverConfig.CoreConfig, "Seed removed from"+driverConfig.EndDir+driverConfig.Env) | ||
} | ||
return nil, nil | ||
} | ||
|
||
// Get files from directory | ||
tempTemplatePaths := []string{} | ||
for _, startDir := range driverConfig.StartDir { | ||
//get files from directory | ||
tp := xutil.GetDirFiles(startDir) | ||
tempTemplatePaths = append(tempTemplatePaths, tp...) | ||
} | ||
|
||
//Duplicate path remover | ||
keys := make(map[string]bool) | ||
templatePaths := []string{} | ||
for _, path := range tempTemplatePaths { | ||
if _, value := keys[path]; !value { | ||
keys[path] = true | ||
templatePaths = append(templatePaths, path) | ||
} | ||
} | ||
|
||
tierceronEngine, err := trcdb.CreateEngine(driverConfig, | ||
templatePaths, driverConfig.Env, driverConfig.VersionFilter[0]) | ||
if err != nil { | ||
eUtils.LogErrorObject(&driverConfig.CoreConfig, err, false) | ||
return nil, err | ||
} | ||
|
||
return tierceronEngine, nil | ||
} | ||
package xdbutil | ||
|
||
import ( | ||
"os" | ||
|
||
trcdb "github.com/trimble-oss/tierceron/atrium/trcdb" | ||
"github.com/trimble-oss/tierceron/pkg/trcx/xutil" | ||
eUtils "github.com/trimble-oss/tierceron/pkg/utils" | ||
) | ||
|
||
// GenerateSeedsFromVaultToDb pulls all data from vault for each template into a database | ||
func GenerateSeedsFromVaultToDb(driverConfig *eUtils.DriverConfig) (interface{}, error) { | ||
if driverConfig.Diff { //Clean flag in trcx | ||
_, err1 := os.Stat(driverConfig.EndDir + driverConfig.Env) | ||
err := os.RemoveAll(driverConfig.EndDir + driverConfig.Env) | ||
|
||
if err != nil { | ||
eUtils.LogErrorObject(&driverConfig.CoreConfig, err, false) | ||
return nil, err | ||
} | ||
|
||
if err1 == nil { | ||
eUtils.LogInfo(&driverConfig.CoreConfig, "Seed removed from"+driverConfig.EndDir+driverConfig.Env) | ||
} | ||
return nil, nil | ||
} | ||
|
||
// Get files from directory | ||
tempTemplatePaths := []string{} | ||
for _, startDir := range driverConfig.StartDir { | ||
//get files from directory | ||
tp := xutil.GetDirFiles(startDir) | ||
tempTemplatePaths = append(tempTemplatePaths, tp...) | ||
} | ||
|
||
//Duplicate path remover | ||
keys := make(map[string]bool) | ||
templatePaths := []string{} | ||
for _, path := range tempTemplatePaths { | ||
if _, value := keys[path]; !value { | ||
keys[path] = true | ||
templatePaths = append(templatePaths, path) | ||
} | ||
} | ||
|
||
tierceronEngine, err := trcdb.CreateEngine(driverConfig, | ||
templatePaths, driverConfig.Env, driverConfig.VersionFilter[0]) | ||
if err != nil { | ||
eUtils.LogErrorObject(&driverConfig.CoreConfig, err, false) | ||
return nil, err | ||
} | ||
|
||
return tierceronEngine, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.