Skip to content

Commit

Permalink
Merge pull request #2006 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
coddmeistr authored Feb 21, 2025
2 parents 35b25e4 + 6ec87d0 commit 7319116
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0
github.com/rabbitmq/amqp091-go v1.9.0
github.com/rs/cors v1.10.1
github.com/slntopp/nocloud-proto v0.0.0-20250212175505-5d285dcff60b
github.com/slntopp/nocloud-proto v0.0.0-20250214111403-7e86f336aa60
github.com/spf13/viper v1.18.2
github.com/stoewer/go-strcase v1.3.0
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/slntopp/nocloud-proto v0.0.0-20250212175505-5d285dcff60b h1:/RqOqgzF40Kp0LL4kzcOd34im9xpq+Hg8XYwVlTgxTw=
github.com/slntopp/nocloud-proto v0.0.0-20250212175505-5d285dcff60b/go.mod h1:qPbslPB2J9Q7qm6H9Jaqf/Ysf61YlPL0DUFhIdAEikI=
github.com/slntopp/nocloud-proto v0.0.0-20250214111403-7e86f336aa60 h1:1kLiPf43Xda+QSluJC/W2gD+fm/qbz2vPPQNVFjRegM=
github.com/slntopp/nocloud-proto v0.0.0-20250214111403-7e86f336aa60/go.mod h1:qPbslPB2J9Q7qm6H9Jaqf/Ysf61YlPL0DUFhIdAEikI=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
Expand Down
2 changes: 1 addition & 1 deletion pkg/billing/cron_send_services_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func formatDate(date string, slashes bool, yearFirst bool, trimTime bool) string
date = date[:10]
}
if slashes {
date = strings.Replace(date, "-", "/", -1)
date = strings.Replace(date, "-", "-", -1)
}
if yearFirst {
date = date[6:] + string(date[5]) + string(date[3]) + string(date[4]) + string(date[2]) + string(date[0]) + string(date[1])
Expand Down
36 changes: 36 additions & 0 deletions pkg/graph/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,24 @@ func (ctrl *instancesController) Create(ctx context.Context, group driver.Docume
if err = ctrl.ansPs.Publish("hooks", services_registry.Topic("ansible_hooks"), &c); err != nil {
log.Error("Failed to publish ansible hook", zap.Error(err))
}
for _, a := range i.GetAddons() {
addon, err := ctrl.addons.Get(ctx, a)
if err != nil {
log.Error("Failed to get instance addon", zap.Error(err), zap.String("addon", a))
continue
}
if addon.Action != nil && addon.Action.GetPlaybook() != "" {
c := pb.Context{
Instance: i.GetUuid(),
Sp: sp,
Event: "START",
Addon: &a,
}
if err = ctrl.ansPs.Publish("hooks", services_registry.Topic("ansible_hooks"), &c); err != nil {
log.Error("Failed to publish ansible hook addon event", zap.Error(err))
}
}
}
}
e := epb.Event{
Uuid: i.GetUuid(),
Expand Down Expand Up @@ -785,6 +803,24 @@ func (ctrl *instancesController) Update(ctx context.Context, _ string, inst, old
if err = ctrl.ansPs.Publish("hooks", services_registry.Topic("ansible_hooks"), &c); err != nil {
log.Error("Failed to publish ansible hook", zap.Error(err))
}
for _, a := range inst.GetAddons() {
addon, err := ctrl.addons.Get(ctx, a)
if err != nil {
log.Error("Failed to get instance addon", zap.Error(err), zap.String("addon", a))
continue
}
if addon.Action != nil && addon.Action.GetPlaybook() != "" {
c := pb.Context{
Instance: inst.GetUuid(),
Sp: sp,
Event: "START",
Addon: &a,
}
if err = ctrl.ansPs.Publish("hooks", services_registry.Topic("ansible_hooks"), &c); err != nil {
log.Error("Failed to publish ansible hook addon event", zap.Error(err))
}
}
}
}
c := pb.Context{
Instance: uuid,
Expand Down

0 comments on commit 7319116

Please sign in to comment.