@@ -1002,55 +1002,6 @@ func (c *Config) GetUserIDByName(name string) (string, error) {
10021002 return user .ID , nil
10031003}
10041004
1005- func (c * Config ) activateDriver (id string , interval time.Duration ) error {
1006- if id == googleConfigDriver {
1007- return c .activateKontainerDriver (id , interval )
1008- }
1009-
1010- return c .activateNodeDriver (id , interval )
1011- }
1012-
1013- func (c * Config ) activateKontainerDriver (id string , interval time.Duration ) error {
1014- if id == "" {
1015- return fmt .Errorf ("[ERROR] Node Driver id is nil" )
1016- }
1017-
1018- client , err := c .ManagementClient ()
1019- if err != nil {
1020- return err
1021- }
1022-
1023- ctx , cancel := context .WithTimeout (context .Background (), interval )
1024- defer cancel ()
1025- for updated := false ; ; {
1026- driver , err := client .KontainerDriver .ByID (id )
1027- if err != nil && ! IsServerError (err ) && ! IsUnknownSchemaType (err ) && ! IsNotFound (err ) && ! IsForbidden (err ) {
1028- return fmt .Errorf ("[ERROR] Getting Node Driver %s: %v" , id , err )
1029- }
1030- if driver != nil {
1031- if driver .State == "active" {
1032- return nil
1033- }
1034-
1035- if ! updated {
1036- err = client .KontainerDriver .ActionActivate (driver )
1037- if err == nil {
1038- updated = true
1039- continue
1040- }
1041- if ! IsServerError (err ) && ! IsUnknownSchemaType (err ) {
1042- return fmt .Errorf ("[ERROR] Activating Node Driver %s: %v" , id , err )
1043- }
1044- }
1045- }
1046- select {
1047- case <- time .After (rancher2RetriesWait * time .Second ):
1048- case <- ctx .Done ():
1049- return fmt .Errorf ("Timeout activating Node Driver %s: %v" , id , err )
1050- }
1051- }
1052- }
1053-
10541005func (c * Config ) activateNodeDriver (id string , interval time.Duration ) error {
10551006 if id == "" {
10561007 return fmt .Errorf ("[ERROR] Node Driver id is nil" )
0 commit comments