File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed
Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 11package cdev
22
33import (
4+ "github.com/apex/log"
45 "github.com/shalb/cluster.dev/pkg/config"
56 "github.com/shalb/cluster.dev/pkg/project"
7+ "github.com/shalb/cluster.dev/pkg/utils"
68 "github.com/spf13/cobra"
79)
810
@@ -14,7 +16,9 @@ var applyCmd = &cobra.Command{
1416 Short : "Deploys or updates infrastructure according to project configuration" ,
1517 RunE : func (cmd * cobra.Command , args []string ) error {
1618 project , err := project .LoadProjectFull ()
17-
19+ if utils .GetEnv ("CDEV_COLLECT_USAGE_STATS" , "false" ) == "true" {
20+ log .Infof ("Sending usage statistic. To disable statistics collection, export the CDEV_COLLECT_USAGE_STATS=false environment variable" )
21+ }
1822 if err != nil {
1923 return NewCmdErr (project , "apply" , err )
2024 }
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ func (p *Project) readStacks() error {
4343 return err
4444 }
4545 }
46+ if len (p .Stacks ) == 0 {
47+ return fmt .Errorf ("no stacks found, at least one needed" )
48+ }
4649 return nil
4750}
4851
@@ -51,6 +54,17 @@ func (p *Project) readStackObj(stackSpec ObjectData) error {
5154 if ! ok {
5255 return fmt .Errorf ("stack object must contain field 'name'" )
5356 }
57+ disabledInt := stackSpec .data ["disabled" ]
58+ if disabledInt != nil {
59+ disabled , ok := disabledInt .(bool )
60+ if ! ok {
61+ return fmt .Errorf ("stack option 'disabled' should be bool, not %T" , disabledInt )
62+ }
63+ if disabled {
64+ log .Debugf ("stack '%v' is disabled, ignore" , name )
65+ return nil
66+ }
67+ }
5468 // Check if stack with this name is already exists in project.
5569 if _ , ok = p .Stacks [name ]; ok {
5670 return fmt .Errorf ("duplicate stack name '%s'" , name )
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ func (e *StatsExporter) PushStats(stats interface{}) error {
4646 client := http.Client {
4747 Timeout : 3 * time .Second ,
4848 }
49- log .Warnf ("Sending usage statistic. To disable statistics collection, export the CDEV_COLLECT_USAGE_STATS=false environment variable" )
5049 log .Debugf ("Usage stats:\n %v" , string (jsonBody ))
5150 res , err := client .Do (req )
5251 if err != nil {
Original file line number Diff line number Diff line change 11name : cdev-tests-local
22template : ./local-tmpl/
33kind : Stack
4+ disabled : false
45backend : aws-backend
56variables :
67 data : {{ remoteState "cdev-tests.create-bucket.test" }}
You can’t perform that action at this time.
0 commit comments