Skip to content

Commit 716cd4d

Browse files
add new decomission action
1 parent 6690499 commit 716cd4d

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎env/env.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ func SetEnvOn() {
5555

5656
// IsSet returns if the given env key is set.
5757
func IsSet(key string) bool {
58-
_, _, _, ok := LookupEnv(key)
59-
return ok
58+
_, _, _, err := LookupEnv(key)
59+
return err == nil
6060
}
6161

6262
// Get retrieves the value of the environment variable named
@@ -70,7 +70,7 @@ func Get(key, defaultValue string) string {
7070
if ok {
7171
return defaultValue
7272
}
73-
if v, _, _, ok := LookupEnv(key); ok {
73+
if v, _, _, err := LookupEnv(key); err == nil {
7474
return v
7575
}
7676
return defaultValue

‎env/web_env.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func Environ() []string {
175175
// Additionally if the input is env://username:password@remote:port/
176176
// to fetch ENV values for the env value from a remote server.
177177
// In this case, it also returns the credentials username and password
178-
func LookupEnv(key string) (string, string, string, bool) {
178+
func LookupEnv(key string) (string, string, string, error) {
179179
v, ok := os.LookupEnv(key)
180180
if ok && strings.HasPrefix(v, webEnvScheme) {
181181
// If env value starts with `env*://`
@@ -186,15 +186,16 @@ func LookupEnv(key string) (string, string, string, bool) {
186186
env, eok := os.LookupEnv("_" + key)
187187
if eok {
188188
// fallback to cached value if-any.
189-
return env, user, pwd, eok
189+
return env, user, pwd, nil
190190
}
191+
return env, user, pwd, err
191192
}
192193
// Set the ENV value to _env value,
193194
// this value is a fallback in-case of
194195
// server restarts when webhook server
195196
// is down.
196197
os.Setenv("_"+key, v)
197-
return v, user, pwd, true
198+
return v, user, pwd, nil
198199
}
199-
return v, "", "", ok
200+
return v, "", "", nil
200201
}

‎iam/policy/admin-action.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const (
2828
// HealAdminAction - allows heal command
2929
HealAdminAction = "admin:Heal"
3030

31+
// DecomissionAdminAction - allows decomissioning of pools
32+
DecomissionAdminAction = "admin:Decomission"
33+
3134
// Service Actions
3235

3336
// StorageInfoAdminAction - allow listing server info

0 commit comments

Comments
 (0)