@@ -10,7 +10,6 @@ import (
1010 "encoding/hex"
1111 "encoding/json"
1212 "fmt"
13- "io/ioutil"
1413 "net"
1514 "os"
1615 "os/exec"
@@ -286,23 +285,23 @@ func getConfigHome() string {
286285}
287286
288287func getGatewaySiteId (gatewayDir string ) (string , error ) {
289- siteId , err := ioutil .ReadFile (gatewayDir + "/config/siteid.txt" )
288+ siteId , err := os .ReadFile (gatewayDir + "/config/siteid.txt" )
290289 if err != nil {
291290 return "" , fmt .Errorf ("Failed to read site id: %w" , err )
292291 }
293292 return string (siteId ), nil
294293}
295294
296295func getRouterId (gatewayDir string ) (string , error ) {
297- routerId , err := ioutil .ReadFile (gatewayDir + "/config/routerid.txt" )
296+ routerId , err := os .ReadFile (gatewayDir + "/config/routerid.txt" )
298297 if err != nil {
299298 return "" , fmt .Errorf ("Failed to read router id: %w" , err )
300299 }
301300 return string (routerId ), nil
302301}
303302
304303func getRouterUrl (gatewayDir string ) (string , error ) {
305- url , err := ioutil .ReadFile (gatewayDir + "/config/url.txt" )
304+ url , err := os .ReadFile (gatewayDir + "/config/url.txt" )
306305 if err != nil {
307306 return "" , fmt .Errorf ("Failed to read router url: %w" , err )
308307 }
@@ -333,9 +332,9 @@ func getRouterVersion(gatewayName string, gatewayType string) (string, error) {
333332}
334333
335334func getMachineID () (string , error ) {
336- id , err := ioutil .ReadFile ("/var/lib/dbus/machine-id" )
335+ id , err := os .ReadFile ("/var/lib/dbus/machine-id" )
337336 if err != nil {
338- id , err = ioutil .ReadFile ("/etc/machine-id" )
337+ id , err = os .ReadFile ("/etc/machine-id" )
339338 }
340339 if err != nil {
341340 return "" , err
@@ -471,12 +470,12 @@ func setupLocalDir(localDir string) error {
471470
472471func startGatewayUserService (gatewayName , unitDir , localDir string ) error {
473472
474- unitFile , err := ioutil .ReadFile (localDir + "/user/" + gatewayName + ".service" )
473+ unitFile , err := os .ReadFile (localDir + "/user/" + gatewayName + ".service" )
475474 if err != nil {
476475 return fmt .Errorf ("Unable to read service file: %w" , err )
477476 }
478477
479- err = ioutil .WriteFile (unitDir + "/" + gatewayName + ".service" , unitFile , 0644 )
478+ err = os .WriteFile (unitDir + "/" + gatewayName + ".service" , unitFile , 0644 )
480479 if err != nil {
481480 return fmt .Errorf ("Unable to write user unit file: %w" , err )
482481 }
@@ -548,7 +547,7 @@ func updateLocalGatewayConfig(gatewayDir string, gatewayType string, gatewayConf
548547 qdrConfig := template .Must (template .New ("qdrConfig" ).Parse (mc ))
549548 qdrConfig .Execute (& buf , instance )
550549
551- err = ioutil .WriteFile (gatewayDir + "/config/skrouterd.json" , buf .Bytes (), 0644 )
550+ err = os .WriteFile (gatewayDir + "/config/skrouterd.json" , buf .Bytes (), 0644 )
552551 if err != nil {
553552 return fmt .Errorf ("Failed to write config file: %w" , err )
554553 }
@@ -575,7 +574,7 @@ func (cli *VanClient) setupGatewayConfig(ctx context.Context, gatewayName string
575574 }
576575
577576 for _ , cert := range certs {
578- err = ioutil .WriteFile (gatewayDir + "/skupper-router-certs/conn1-profile/" + cert , secret .Data [cert ], 0644 )
577+ err = os .WriteFile (gatewayDir + "/skupper-router-certs/conn1-profile/" + cert , secret .Data [cert ], 0644 )
579578 if err != nil {
580579 return fmt .Errorf ("Failed to write cert file: %w" , err )
581580 }
@@ -602,14 +601,14 @@ func (cli *VanClient) setupGatewayConfig(ctx context.Context, gatewayName string
602601
603602 // store the url for instance queries
604603 url := fmt .Sprintf ("amqp://127.0.0.1:%s" , strconv .Itoa (amqpPort ))
605- err = ioutil .WriteFile (gatewayDir + "/config/url.txt" , []byte (url ), 0644 )
604+ err = os .WriteFile (gatewayDir + "/config/url.txt" , []byte (url ), 0644 )
606605 if err != nil {
607606 return fmt .Errorf ("Failed to write instance url file: %w" , err )
608607 }
609608
610609 // generate a router id and store it for subsequent template updates
611610 routerId := newUUID ()
612- err = ioutil .WriteFile (gatewayDir + "/config/routerid.txt" , []byte (routerId ), 0644 )
611+ err = os .WriteFile (gatewayDir + "/config/routerid.txt" , []byte (routerId ), 0644 )
613612 if err != nil {
614613 return fmt .Errorf ("Failed to write instance id file: %w" , err )
615614 }
@@ -620,7 +619,7 @@ func (cli *VanClient) setupGatewayConfig(ctx context.Context, gatewayName string
620619 return fmt .Errorf ("Failed to retrieve site id: %w" , err )
621620 }
622621 if siteConfig != nil {
623- err = ioutil .WriteFile (gatewayDir + "/config/siteid.txt" , []byte (siteConfig .Reference .UID ), 0644 )
622+ err = os .WriteFile (gatewayDir + "/config/siteid.txt" , []byte (siteConfig .Reference .UID ), 0644 )
624623 if err != nil {
625624 return fmt .Errorf ("Failed to write site id file: %w" , err )
626625 }
@@ -664,7 +663,7 @@ func (cli *VanClient) setupGatewayConfig(ctx context.Context, gatewayName string
664663 qdrConfig := template .Must (template .New ("qdrConfig" ).Parse (mc ))
665664 qdrConfig .Execute (& buf , instance )
666665
667- err = ioutil .WriteFile (gatewayDir + "/config/skrouterd.json" , buf .Bytes (), 0644 )
666+ err = os .WriteFile (gatewayDir + "/config/skrouterd.json" , buf .Bytes (), 0644 )
668667 if err != nil {
669668 return fmt .Errorf ("Failed to write config file: %w" , err )
670669 }
@@ -693,7 +692,7 @@ func (cli *VanClient) gatewayStartService(ctx context.Context, gatewayName strin
693692 ConfigPath : gatewayDir ,
694693 GatewayName : gatewayName ,
695694 })
696- err = ioutil .WriteFile (gatewayDir + "/user/" + gatewayName + ".service" , []byte (qdrUserUnit ), 0644 )
695+ err = os .WriteFile (gatewayDir + "/user/" + gatewayName + ".service" , []byte (qdrUserUnit ), 0644 )
697696 if err != nil {
698697 return fmt .Errorf ("Failed to write unit file: %w" , err )
699698 }
@@ -926,7 +925,7 @@ func (cli *VanClient) newGateway(ctx context.Context, gatewayName string, gatewa
926925
927926 if configFile != "" {
928927 // grab the bindings and forwards from the config file
929- yamlFile , err := ioutil .ReadFile (configFile )
928+ yamlFile , err := os .ReadFile (configFile )
930929 if err != nil {
931930 return "" , fmt .Errorf ("Failed to read gateway config file: %w" , err )
932931 }
@@ -1138,7 +1137,7 @@ func (cli *VanClient) GatewayInit(ctx context.Context, gatewayName string, gatew
11381137 }
11391138
11401139 if configFile != "" && gatewayType != GatewayMockType {
1141- yamlFile , err := ioutil .ReadFile (configFile )
1140+ yamlFile , err := os .ReadFile (configFile )
11421141 if err != nil {
11431142 return "" , fmt .Errorf ("Failed to read gateway config file: %w" , err )
11441143 }
@@ -2055,7 +2054,7 @@ func (cli *VanClient) GatewayExportConfig(ctx context.Context, targetGatewayName
20552054 return exportFile , fmt .Errorf ("Failed to marshal export config: %w" , err )
20562055 }
20572056
2058- err = ioutil .WriteFile (exportFile , mcData , 0644 )
2057+ err = os .WriteFile (exportFile , mcData , 0644 )
20592058 if err != nil {
20602059 return exportFile , fmt .Errorf ("Failed to write export config file: %w" , err )
20612060 }
@@ -2071,7 +2070,7 @@ func (cli *VanClient) GatewayGenerateBundle(ctx context.Context, configFile stri
20712070 return "" , fmt .Errorf ("Skupper is not enabled in namespace '%s'" , cli .Namespace )
20722071 }
20732072
2074- yamlFile , err := ioutil .ReadFile (configFile )
2073+ yamlFile , err := os .ReadFile (configFile )
20752074 if err != nil {
20762075 return "" , fmt .Errorf ("Failed to read gateway config file: %w" , err )
20772076 }
0 commit comments