Skip to content

Commit

Permalink
Merge pull request #97 from BESTSELLER/harbor_2.2_updates
Browse files Browse the repository at this point in the history
data project now checks for empty string on autoscan
  • Loading branch information
wrighbr authored Mar 10, 2021
2 parents ea7b1d0 + e606685 commit d684830
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type ProjectsBodyResponses struct {
} `json:"cve_allowlist"`
Metadata struct {
EnableContentTrust string `json:"enable_content_trust"`
AutoScan string `json:"auto_scan"`
AutoScan string `json:"auto_scan,omitempty"`
Severity string `json:"severity"`
ReuseSysCveAllowlist string `json:"reuse_sys_cve_allowlist"`
Public string `json:"public"`
Expand Down
13 changes: 10 additions & 3 deletions provider/data_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,16 @@ func dataProjectRead(d *schema.ResourceData, m interface{}) error {
if err != nil {
return err
}
autoScan, err := strconv.ParseBool(v.Metadata.AutoScan)
if err != nil {
return err

var autoScan bool
scan := v.Metadata.AutoScan
if scan == "" {
autoScan = false
} else {
autoScan, err = strconv.ParseBool(scan)
if err != nil {
return err
}
}

d.SetId(id)
Expand Down

0 comments on commit d684830

Please sign in to comment.