Skip to content

Commit

Permalink
Merge pull request #15 from daidokoro/0.50-beta
Browse files Browse the repository at this point in the history
0.50 beta
  • Loading branch information
daidokoro authored May 1, 2017
2 parents c38ee9a + 76dc648 commit 4959dc8
Show file tree
Hide file tree
Showing 21 changed files with 723 additions and 598 deletions.
371 changes: 23 additions & 348 deletions README.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion commands/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ func (s *sessionManager) GetSess(p string) (*session.Session, error) {
}

options := session.Options{
Config: aws.Config{Region: &s.region},
Profile: p,
SharedConfigState: session.SharedConfigEnable,
}

if s.region != "" {
options.Config = aws.Config{Region: &s.region}
}

Log(fmt.Sprintf("Creating AWS Session with options: Regioin: %s, Profile: %s ", region, job.profile), level.debug)
sess, err := session.NewSessionWithOptions(options)
if err != nil {
Expand Down
45 changes: 24 additions & 21 deletions commands/change.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ var create = &cobra.Command{
Short: "Create Changet-Set",
Run: func(cmd *cobra.Command, args []string) {
job.request = "change-set create"
var s string
var source string

if len(args) < 1 {
fmt.Println("Please provide Change-Set Name...")
Expand All @@ -28,41 +30,42 @@ var create = &cobra.Command{

job.changeName = args[0]

s, source, err := getSource(job.tplFile)
err := configReader(job.cfgSource)
if err != nil {
handleError(err)
return
}

job.tplFile = source

err = configReader(job.cfgFile)
if err != nil {
handleError(err)
return
if job.tplSource != "" {
s, source, err = getSource(job.tplSource)
if err != nil {
handleError(err)
return
}
}

v, err := genTimeParser(job.tplFile)
if err != nil {
handleError(err)
return
if len(args) > 0 {
s = args[0]
}

// Handle missing stacks
if stacks[s] == nil {
handleError(fmt.Errorf("Missing Stack in %s: [%s]", job.cfgFile, s))
// check if stack exists in config
if _, ok := stacks[s]; !ok {
handleError(fmt.Errorf("Stack [%s] not found in config", s))
return
}

stacks[s].template = v
if stacks[s].source == "" {
stacks[s].source = source
}

// resolve deploy time function
if err = stacks[s].deployTimeParser(); err != nil {
if err = stacks[s].genTimeParser(); err != nil {
handleError(err)
return
}

if err := stacks[s].change("create"); err != nil {
handleError(err)
return
}

},
Expand All @@ -86,7 +89,7 @@ var rm = &cobra.Command{

job.changeName = args[0]

err := configReader(job.cfgFile)
err := configReader(job.cfgSource)
if err != nil {
handleError(err)
return
Expand Down Expand Up @@ -116,7 +119,7 @@ var list = &cobra.Command{
return
}

err := configReader(job.cfgFile)
err := configReader(job.cfgSource)
if err != nil {
handleError(err)
return
Expand Down Expand Up @@ -152,7 +155,7 @@ var execute = &cobra.Command{

job.changeName = args[0]

err := configReader(job.cfgFile)
err := configReader(job.cfgSource)
if err != nil {
handleError(err)
return
Expand Down Expand Up @@ -188,7 +191,7 @@ var desc = &cobra.Command{

job.changeName = args[0]

err := configReader(job.cfgFile)
err := configReader(job.cfgSource)
if err != nil {
handleError(err)
return
Expand Down
Loading

0 comments on commit 4959dc8

Please sign in to comment.