Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fdevans committed Oct 6, 2023
1 parent 07f8a17 commit 8fcfa15
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ example.tf
terraform.tfplan
terraform.tfstate
bin/
dist/
modules-dev/
/pkg/
website/.vagrant
Expand All @@ -29,3 +30,6 @@ website/vendor
# Test exclusions
!command/test-fixtures/**/*.tfstate
!command/test-fixtures/**/.terraform/

# Keep windows files with windows line endings
*.winfile eol=crlf
4 changes: 2 additions & 2 deletions rundeck/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func ReadProject(d *schema.ResourceData, meta interface{}) error {
}

if project.StatusCode == 404 {
return fmt.Errorf("Project not found: (%s)", name)
return fmt.Errorf("project not found: (%s)", name)
}

projectConfig := project.Config.(map[string]interface{})
Expand Down Expand Up @@ -342,7 +342,7 @@ func resourceProjectImport(d *schema.ResourceData, meta interface{}) ([]*schema.
return nil, err
}
if !ok {
return nil, fmt.Errorf("Project doesn't exist. Please try again.")
return nil, fmt.Errorf("project doesn't exist. Please try again")
}
d.SetId(name)

Expand Down
12 changes: 6 additions & 6 deletions rundeck/resource_public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package rundeck
import (
"context"
"fmt"
"io/ioutil"
"io"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
Expand Down Expand Up @@ -56,12 +56,12 @@ func CreatePublicKey(d *schema.ResourceData, meta interface{}) error {
path := d.Get("path").(string)
keyMaterial := d.Get("key_material").(string)

keyMaterialReader := ioutil.NopCloser(strings.NewReader(keyMaterial))
keyMaterialReader := io.NopCloser(strings.NewReader(keyMaterial))

Check failure on line 59 in rundeck/resource_public_key.go

View workflow job for this annotation

GitHub Actions / Build

undefined: io.NopCloser

if keyMaterial != "" {
resp, err := client.StorageKeyCreate(ctx, path, keyMaterialReader, "application/pgp-keys")
if resp.StatusCode == 409 {
err = fmt.Errorf("Conflict creating key at : %s", path)
err = fmt.Errorf("conflict creating key at : %s", path)
}
if err != nil {
return err
Expand All @@ -86,7 +86,7 @@ func UpdatePublicKey(d *schema.ResourceData, meta interface{}) error {
path := d.Get("path").(string)
keyMaterial := d.Get("key_material").(string)

keyMaterialReader := ioutil.NopCloser(strings.NewReader(keyMaterial))
keyMaterialReader := io.NopCloser(strings.NewReader(keyMaterial))

Check failure on line 89 in rundeck/resource_public_key.go

View workflow job for this annotation

GitHub Actions / Build

undefined: io.NopCloser

resp, err := client.StorageKeyUpdate(ctx, path, keyMaterialReader, "application/pgp-keys")
if resp.StatusCode == 409 || err != nil {
Expand Down Expand Up @@ -133,7 +133,7 @@ func ReadPublicKey(d *schema.ResourceData, meta interface{}) error {

key, err := client.StorageKeyGetMetadata(ctx, path)
if key.StatusCode == 404 {
err = fmt.Errorf("Key not found at: %s", path)
err = fmt.Errorf("key not found at: %s", path)
}

if err != nil {
Expand All @@ -145,7 +145,7 @@ func ReadPublicKey(d *schema.ResourceData, meta interface{}) error {
return err
}

keyMaterial, err := ioutil.ReadAll(resp.Body)
keyMaterial, err := io.ReadAll(resp.Body)

Check failure on line 148 in rundeck/resource_public_key.go

View workflow job for this annotation

GitHub Actions / Build

undefined: io.ReadAll
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions rundeck/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ func marshalMapToXML(c *map[string]string, e *xml.Encoder, start xml.StartElemen
val2 := e.EncodeToken(xml.StartElement{
Name: xml.Name{Local: entryName},
Attr: []xml.Attr{
xml.Attr{
{
Name: xml.Name{Local: keyName},
Value: k,
},
xml.Attr{
{
Name: xml.Name{Local: valueName},
Value: v,
},
Expand Down

0 comments on commit 8fcfa15

Please sign in to comment.