Skip to content
This repository was archived by the owner on Jan 14, 2020. It is now read-only.

Commit a76b719

Browse files
dbaggermanojkelly
authored andcommitted
Bugfixes (#108)
* amend whitelisted environment message Print the environment name, not the environment object Include the account ID in the suggested resolution * remove path restriction on filesystem access
1 parent e9c4fbd commit a76b719

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

internal/core/object_store.go

-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ func NewFilesystemStore(basedir string) *FileSystemStore {
2929
}
3030

3131
func (fs *FileSystemStore) Get(path string, subpath ...string) ([]byte, error) {
32-
if filepath.IsAbs(path) {
33-
return nil, fmt.Errorf("get object: only relative paths allowed")
34-
}
35-
3632
// go doesn't allow passing mixed values and variadic arrays so we need to
3733
// collapse it to a single array first
3834
keys := append([]string{fs.basedir, path}, subpath...)

internal/tasks/upsert.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func upsert(
106106
paramsPath string,
107107
cliTags map[string]string,
108108
devPluginPath string,
109-
env string,
109+
envName string,
110110
generateDefaultOutputs bool,
111111
capabilities []*string,
112112
confirm bool,
@@ -159,11 +159,11 @@ func upsert(
159159
paramMap[key] = value
160160
}
161161

162-
if env, ok := manifestFile.Environments[env]; ok {
162+
if env, ok := manifestFile.Environments[envName]; ok {
163163
if !env.IsWhitelistedAccount(acctID) {
164164
printer.Fatal(
165-
fmt.Errorf("Account %s is not allowed for environment %s", acctID, env),
166-
"Use whitelisted account, or add account to environment accounts in kombustion.yaml",
165+
fmt.Errorf("Account %s is not allowed for environment %s", acctID, envName),
166+
fmt.Sprintf("Use whitelisted account, or add account %s to environment accounts in kombustion.yaml", acctID),
167167
"",
168168
)
169169
}
@@ -173,7 +173,7 @@ func upsert(
173173
if tags == nil {
174174
tags = make(map[string]string)
175175
}
176-
if env, ok := manifestFile.Environments[env]; ok {
176+
if env, ok := manifestFile.Environments[envName]; ok {
177177
for key, value := range env.Tags {
178178
tags[key] = value
179179
}
@@ -187,7 +187,7 @@ func upsert(
187187
generateParams := cloudformation.GenerateParams{
188188
ObjectStore: objectStore,
189189
Filename: templatePath,
190-
Env: env,
190+
Env: envName,
191191
GenerateDefaultOutputs: generateDefaultOutputs || manifestFile.GenerateDefaultOutputs,
192192
ParamMap: paramMap,
193193
Plugins: loadedPlugins,
@@ -196,14 +196,14 @@ func upsert(
196196
// CloudFormation Stack parameters
197197
var parameters []*awsCF.Parameter
198198

199-
fullStackName := cloudformation.GetStackName(manifestFile, templatePath, env, stackName)
199+
fullStackName := cloudformation.GetStackName(manifestFile, templatePath, envName, stackName)
200200

201201
printer.Progress("Upserting template")
202202

203203
// FIXME - this previously looked for a --url param to use a template in
204204
// S3. This should probably be reimplemented around an S3ObjectStore
205205
templateBody, cfYaml := tasks.GenerateYamlTemplate(generateParams)
206-
parameters = cloudformation.ResolveParameters(env, paramMap, cfYaml, manifestFile)
206+
parameters = cloudformation.ResolveParameters(envName, paramMap, cfYaml, manifestFile)
207207

208208
tasks.UpsertStackBody(
209209
templateBody,

0 commit comments

Comments
 (0)