diff --git a/go.mod b/go.mod index de65426775..00fd9bdc54 100644 --- a/go.mod +++ b/go.mod @@ -88,7 +88,7 @@ require ( k8s.io/client-go v0.19.3 k8s.io/cluster-bootstrap v0.19.3 moul.io/http2curl/v2 v2.3.0 - yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240514110447-1183a70bd704 + yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240514124346-2e662f930eaf yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 yunion.io/x/jsonutils v1.0.1-0.20240203102553-4096f103b401 yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91 diff --git a/go.sum b/go.sum index 786f7dd891..b0a06798f5 100644 --- a/go.sum +++ b/go.sum @@ -1208,8 +1208,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240514110447-1183a70bd704 h1:q4PJPMHqMINFeYoCehXErUwDyJWMCTONdHwEz/n0pRQ= -yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240514110447-1183a70bd704/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM= +yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240514124346-2e662f930eaf h1:YDpkOBXPWqvycSOIisnDAQc+3pTyq45hKeeLsavryX0= +yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240514124346-2e662f930eaf/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM= yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug= yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws= yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634= diff --git a/vendor/modules.txt b/vendor/modules.txt index 82d3581e39..4ce9e2634f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1479,7 +1479,7 @@ sigs.k8s.io/structured-merge-diff/v4/value # sigs.k8s.io/yaml v1.2.0 ## explicit; go 1.12 sigs.k8s.io/yaml -# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240514110447-1183a70bd704 +# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240514124346-2e662f930eaf ## explicit; go 1.18 yunion.io/x/cloudmux/pkg/apis yunion.io/x/cloudmux/pkg/apis/billing diff --git a/vendor/yunion.io/x/cloudmux/pkg/multicloud/azure/web_app.go b/vendor/yunion.io/x/cloudmux/pkg/multicloud/azure/web_app.go index 51784ee916..d85acfde84 100644 --- a/vendor/yunion.io/x/cloudmux/pkg/multicloud/azure/web_app.go +++ b/vendor/yunion.io/x/cloudmux/pkg/multicloud/azure/web_app.go @@ -124,7 +124,7 @@ func (as *SAppSite) GetStack() (string, error) { if len(as.stack) > 0 { return as.stack, nil } - res := fmt.Sprintf("%s/config/metadata", as.Id) + res := fmt.Sprintf("%s/config/metadata/list", as.Id) resp, err := as.region.post_v2(res, "2023-12-01", nil) if err != nil { return "", nil @@ -267,14 +267,61 @@ func (a *SAppSite) GetTechStack() string { if s, ok := techStacks[stack]; ok { return s } + + res := fmt.Sprintf("%s/config", a.Id) + resp, err := a.region.list_v2(res, "2023-12-01", nil) + if err != nil { + return "" + } + value := []struct { + Properties struct { + PhpVersion string + PythonVersion string + NodeVersion string + PowerShellVersion string + JavaVersion string + } + }{} + resp.Unmarshal(&value, "value") + for _, v := range value { + if len(v.Properties.NodeVersion) > 0 { + return "Node" + } + if len(v.Properties.PhpVersion) > 0 { + return "PHP" + } + if len(v.Properties.PowerShellVersion) > 0 { + return "PowerShell" + } + if len(v.Properties.JavaVersion) > 0 { + return "Java" + } + } return stack } func (a *SAppSite) GetOsType() cloudprovider.TOsType { - if strings.Contains(strings.ToLower(a.GetTechStack()), "net") { - return cloudprovider.OsTypeWindows + res := fmt.Sprintf("%s/config", a.Id) + resp, err := a.region.list_v2(res, "2023-12-01", nil) + if err != nil { + return cloudprovider.OsTypeLinux } - return cloudprovider.OsTypeLinux + value := []struct { + Properties struct { + LinuxFxVersion string + WindowsFxVersion string + } + }{} + resp.Unmarshal(&value, "value") + for _, v := range value { + if len(v.Properties.LinuxFxVersion) > 0 { + return cloudprovider.OsTypeLinux + } + if len(v.Properties.WindowsFxVersion) > 0 { + return cloudprovider.OsTypeWindows + } + } + return cloudprovider.OsTypeWindows } func (self *SAppSite) SetTags(tags map[string]string, replace bool) error {