Skip to content

Commit

Permalink
chore: improve sync and manifest deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickMenoti committed Jul 19, 2024
1 parent 184fd4a commit a4a96b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions pkg/cmd/sync/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ func (synch *SyncCmd) syncRules(info contracts.SyncOpts, f *cmdutil.Factory) err
continue
}
newRule := contracts.AzionJsonDataRules{
Id: rule.GetId(),
Name: rule.GetName(),
Id: rule.GetId(),
Name: rule.GetName(),
Phase: rule.GetPhase(),
}
info.Conf.RulesEngine.Rules = append(info.Conf.RulesEngine.Rules, newRule)
err := synch.WriteAzionJsonContent(info.Conf, ProjectConf)
Expand All @@ -145,7 +146,7 @@ func (synch *SyncCmd) syncEnv(f *cmdutil.Factory) error {
envs, err := godotenv.Read(synch.EnvPath)
if err != nil {
logger.Debug("Error while loading .env file", zap.Error(err))
return err
return nil // not every project has a .env file... this should not stop the execution
}

for _, variable := range resp {
Expand Down
12 changes: 6 additions & 6 deletions pkg/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (man *ManifestInterpreter) CreateResources(
}
updated, err := clientOrigin.Update(ctx, conf.Application.ID, OriginKeys[origin.Name], requestUpdate)
if err != nil {
return fmt.Errorf("%w: %s", msg.ErrorUpdateOrigin, err.Error())
return fmt.Errorf("%w - '%s': %s", msg.ErrorUpdateOrigin, updated.GetName(), err.Error())
}

newEntry := contracts.AzionJsonDataOrigin{
Expand All @@ -142,7 +142,7 @@ func (man *ManifestInterpreter) CreateResources(
}
created, err := clientOrigin.Create(ctx, conf.Application.ID, requestCreate)
if err != nil {
return fmt.Errorf("%w: %s", msg.ErrorCreateOrigin, err.Error())
return fmt.Errorf("%w - '%s': %s", msg.ErrorCreateOrigin, created.GetName(), err.Error())
}
newOrigin := contracts.AzionJsonDataOrigin{
OriginId: created.GetOriginId(),
Expand Down Expand Up @@ -177,7 +177,7 @@ func (man *ManifestInterpreter) CreateResources(
}
updated, err := clientCache.Update(ctx, requestUpdate, conf.Application.ID, id)
if err != nil {
return fmt.Errorf("%w: %s", msg.ErrorUpdateCache, err.Error())
return fmt.Errorf("%w - '%s': %s", msg.ErrorUpdateCache, updated.GetName(), err.Error())
}
newCache := contracts.AzionJsonDataCacheSettings{
Id: updated.GetId(),
Expand All @@ -196,7 +196,7 @@ func (man *ManifestInterpreter) CreateResources(
}
created, err := clientCache.Create(ctx, requestUpdate, conf.Application.ID)
if err != nil {
return fmt.Errorf("%w: %s", msg.ErrorCreateCache, err.Error())
return fmt.Errorf("%w - '%s': %s", msg.ErrorCreateCache, created.GetName(), err.Error())
}
newCache := contracts.AzionJsonDataCacheSettings{
Id: created.GetId(),
Expand Down Expand Up @@ -236,7 +236,7 @@ func (man *ManifestInterpreter) CreateResources(
requestUpdate.IdApplication = conf.Application.ID
updated, err := client.UpdateRulesEngine(ctx, requestUpdate)
if err != nil {
return fmt.Errorf("%w: %s", msg.ErrorUpdateRule, err.Error())
return fmt.Errorf("%w - '%s': %s", msg.ErrorUpdateRule, updated.GetName(), err.Error())
}
newRule := contracts.AzionJsonDataRules{
Id: updated.GetId(),
Expand All @@ -262,7 +262,7 @@ func (man *ManifestInterpreter) CreateResources(
requestCreate.Order = &rule.Order
created, err := client.CreateRulesEngine(ctx, conf.Application.ID, rule.Phase, requestCreate)
if err != nil {
return fmt.Errorf("%w: %s", msg.ErrorCreateRule, err.Error())
return fmt.Errorf("%w - '%s': %s", msg.ErrorCreateRule, created.GetName(), err.Error())
}
newRule := contracts.AzionJsonDataRules{
Id: created.GetId(),
Expand Down

0 comments on commit a4a96b5

Please sign in to comment.