Skip to content

Commit

Permalink
Merge pull request #12 from rightscale/do_not_require_default_parameters
Browse files Browse the repository at this point in the history
Do not require parameters with defaults
  • Loading branch information
pwalwaikar authored Feb 11, 2020
2 parents f3601b3 + 9aec851 commit d526451
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions cmd/fpt/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v1.0.5 / 2020-02-10
-------------------
* Do not require parameters with defaults when running `fpt run` or `fpt retrieve_data`.

v1.0.4 / 2019-08-07
-------------------
* Fix script command with CRLF line endings.
Expand Down
11 changes: 6 additions & 5 deletions cmd/fpt/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/pkg/errors"
"strconv"
"strings"
"time"

"github.com/pkg/errors"

"github.com/rightscale/policy_sdk/client/policy"
"github.com/rightscale/policy_sdk/sdk/applied_policy"
appliedpolicy "github.com/rightscale/policy_sdk/sdk/applied_policy"
"github.com/rightscale/policy_sdk/sdk/incident"
"github.com/rightscale/policy_sdk/sdk/policy_template"
policytemplate "github.com/rightscale/policy_sdk/sdk/policy_template"
)

// Steps:
Expand Down Expand Up @@ -206,8 +207,8 @@ func parseOptions(pt *policytemplate.PolicyTemplate, runOptions []string) ([]*ap
})
seen[bits[0]] = true
}
for name, _ := range pt.Parameters {
if !seen[name] {
for name, parameter := range pt.Parameters {
if parameter.Default == nil && !seen[name] {
errors = append(errors, fmt.Sprintf("%s is required", name))
}
}
Expand Down

0 comments on commit d526451

Please sign in to comment.