File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1129,7 +1129,7 @@ $ scw inspect myserver | jq '.[0].public_ip.address'
11291129
11301130### master (unreleased)
11311131
1132- * No entry
1132+ * Support of ` scw _userdata name VAR=@/path/to/file ` ( [ # 183 ] ( https://github.com/scaleway/scaleway-cli/issues/183 ) )
11331133
11341134View full [ commits list] ( https://github.com/scaleway/scaleway-cli/compare/v1.5.0...master )
11351135
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package cli
66
77import (
88 "fmt"
9+ "io/ioutil"
910 "strings"
1011
1112 "github.com/scaleway/scaleway-cli/pkg/api"
@@ -82,8 +83,17 @@ func runUserdata(cmd *Command, args []string) error {
8283 default :
8384 value := parts [1 ]
8485 if value != "" {
86+ var data []byte
8587 // Set userdata
86- err := Api .PatchUserdata (serverID , key , []byte (value ))
88+ if value [0 ] == '@' {
89+ data , err = ioutil .ReadFile (value [1 :])
90+ if err != nil {
91+ return err
92+ }
93+ } else {
94+ data = []byte (value )
95+ }
96+ err := Api .PatchUserdata (serverID , key , data )
8797 if err != nil {
8898 return err
8999 }
You can’t perform that action at this time.
0 commit comments