@@ -80,11 +80,8 @@ func (s *Stackit) Status(ctx context.Context, projectId, machineName string) (cl
8080 if server == nil {
8181 return client .StatusNotFound , nil
8282 }
83- if server .GetPowerStatus () == nil {
84- return client .StatusNotFound , nil
85- }
8683
87- return statusFromPowerStateString (* server .GetPowerStatus ()), nil
84+ return statusFromPowerStateString (server .GetPowerStatus ()), nil
8885}
8986
9087func (s * Stackit ) Start (ctx context.Context , projectId , machineName string ) error {
@@ -227,7 +224,7 @@ func (s *Stackit) Create(ctx context.Context, options *options.Options, publicKe
227224 NetworkId : network .NetworkId ,
228225 },
229226 },
230- UserData : & userdata ,
227+ UserData : userdata ,
231228 }
232229
233230 server , err := s .client .CreateServer (ctx , options .ProjectID ).CreateServerPayload (createServerPayload ).Execute ()
@@ -286,21 +283,23 @@ func (s *Stackit) Create(ctx context.Context, options *options.Options, publicKe
286283 return nil
287284}
288285
289- func generateUserData (publicKey string ) (string , error ) {
286+ func generateUserData (publicKey string ) (* [] byte , error ) {
290287 t , err := template .New ("cloud-config.yaml" ).ParseFS (cloudConfigFS , "cloud-config.yaml" )
291288 if err != nil {
292- return "" , err
289+ return nil , err
293290 }
294291
295292 output := new (bytes.Buffer )
296293 if err := t .Execute (output , map [string ]string {
297294 "PublicKey" : publicKey ,
298295 "Username" : SSHUserName ,
299296 }); err != nil {
300- return "" , err
297+ return nil , err
301298 }
302299
303- return base64 .StdEncoding .EncodeToString (output .Bytes ()), nil
300+ encodedUserData := base64 .StdEncoding .EncodeToString (output .Bytes ())
301+ byteArray := []byte (encodedUserData )
302+ return & byteArray , nil
304303}
305304
306305func (s * Stackit ) createVolume (ctx context.Context , projectId , volumeName , volumeAvailabilityZone string , volumeSize int64 ) (string , error ) {
0 commit comments