Rename IsImageDebug -> IsDebugImage for consistency

This commit is contained in:
Nils Hanke 2022-09-06 13:06:09 +02:00 committed by Nils Hanke
parent dd4ccdd390
commit fe70231f2a
5 changed files with 6 additions and 6 deletions

View File

@ -56,7 +56,7 @@ func configFetchMeasurements(cmd *cobra.Command, fileHandler file.Handler, clien
return err return err
} }
if conf.IsImageDebug() { if conf.IsDebugImage() {
cmd.Println("Configured image does not look like a released production image. Double check image before deploying to production.") cmd.Println("Configured image does not look like a released production image. Double check image before deploying to production.")
} }

View File

@ -67,7 +67,7 @@ func create(cmd *cobra.Command, creator cloudCreator, fileHandler file.Handler,
return fmt.Errorf("reading and validating config: %w", err) return fmt.Errorf("reading and validating config: %w", err)
} }
if config.IsImageDebug() { if config.IsDebugImage() {
cmd.Println("Configured image does not look like a released production image. Double check image before deploying to production.") cmd.Println("Configured image does not look like a released production image. Double check image before deploying to production.")
} }

View File

@ -61,7 +61,7 @@ func deploy(cmd *cobra.Command, fileHandler file.Handler, constellationConfig *c
return err return err
} }
if !constellationConfig.IsImageDebug() { if !constellationConfig.IsDebugImage() {
log.Println("WARN: constellation image does not look like a debug image. Are you using a debug image?") log.Println("WARN: constellation image does not look like a debug image. Are you using a debug image?")
} }

View File

@ -384,10 +384,10 @@ func (c *Config) RemoveProviderExcept(provider cloudprovider.Provider) {
} }
} }
// IsImageDebug checks whether image name looks like a release image, if not it is // IsDebugImage checks whether image name looks like a release image, if not it is
// probably a debug image. In the end we do not if bootstrapper or debugd // probably a debug image. In the end we do not if bootstrapper or debugd
// was put inside an image just by looking at its name. // was put inside an image just by looking at its name.
func (c *Config) IsImageDebug() bool { func (c *Config) IsDebugImage() bool {
switch { switch {
case c.Provider.GCP != nil: case c.Provider.GCP != nil:
gcpRegex := regexp.MustCompile(`^projects\/constellation-images\/global\/images\/constellation-v[\d]+-[\d]+-[\d]+$`) gcpRegex := regexp.MustCompile(`^projects\/constellation-images\/global\/images\/constellation-v[\d]+-[\d]+-[\d]+$`)

View File

@ -381,7 +381,7 @@ func TestConfig_IsImageDebug(t *testing.T) {
for name, tc := range testCases { for name, tc := range testCases {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
assert.Equal(tc.want, tc.conf.IsImageDebug()) assert.Equal(tc.want, tc.conf.IsDebugImage())
}) })
} }
} }