зеркало из https://github.com/Azure/ARO-RP.git
Merge pull request #764 from jim-minter/staticanalysis
fixes from staticcheck tool
This commit is contained in:
Коммит
24289036c6
|
@ -45,6 +45,10 @@ func getTokenURLFromConsoleURL(consoleURL string) (*url.URL, error) {
|
|||
|
||||
func getAuthorizedToken(ctx context.Context, tokenURL *url.URL, username, password string) (string, error) {
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", tokenURL.String(), nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
req.SetBasicAuth(username, password)
|
||||
req.Header.Add("X-CSRF-Token", "1")
|
||||
|
||||
|
|
|
@ -10,11 +10,6 @@ import (
|
|||
// APIVersion contains a version string as it will be used by clients
|
||||
const APIVersion = "admin"
|
||||
|
||||
const (
|
||||
resourceProviderNamespace = "Microsoft.RedHatOpenShift"
|
||||
resourceType = "openShiftClusters"
|
||||
)
|
||||
|
||||
func init() {
|
||||
api.APIs[APIVersion] = &api.Version{
|
||||
OpenShiftClusterConverter: func() api.OpenShiftClusterConverter {
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"github.com/Azure/ARO-RP/pkg/api/validate"
|
||||
"github.com/Azure/ARO-RP/pkg/database"
|
||||
"github.com/Azure/ARO-RP/pkg/env"
|
||||
"github.com/Azure/ARO-RP/pkg/util/acrtoken"
|
||||
pkgacrtoken "github.com/Azure/ARO-RP/pkg/util/acrtoken"
|
||||
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/features"
|
||||
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/network"
|
||||
|
@ -39,7 +38,7 @@ type Manager struct {
|
|||
keyvault keyvault.Manager
|
||||
privateendpoint privateendpoint.Manager
|
||||
subnet subnet.Manager
|
||||
acrtoken acrtoken.Manager
|
||||
acrtoken pkgacrtoken.Manager
|
||||
|
||||
doc *api.OpenShiftClusterDocument
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
"github.com/Azure/ARO-RP/pkg/util/encryption"
|
||||
encrypt "github.com/Azure/ARO-RP/pkg/util/encryption"
|
||||
)
|
||||
|
||||
var _ codec.InterfaceExt = (*secureBytesExt)(nil)
|
||||
|
@ -45,7 +44,7 @@ func (s secureBytesExt) UpdateExt(dest interface{}, v interface{}) {
|
|||
var _ codec.InterfaceExt = (*secureStringExt)(nil)
|
||||
|
||||
type secureStringExt struct {
|
||||
cipher encrypt.Cipher
|
||||
cipher encryption.Cipher
|
||||
}
|
||||
|
||||
func (s secureStringExt) ConvertExt(v interface{}) interface{} {
|
||||
|
|
|
@ -669,20 +669,20 @@ func (g *generator) vmss() *arm.Resource {
|
|||
}
|
||||
|
||||
parts = append(parts,
|
||||
fmt.Sprintf("'LOCATION=$(base64 -d <<<'''"),
|
||||
fmt.Sprintf("base64(resourceGroup().location)"),
|
||||
"'LOCATION=$(base64 -d <<<'''",
|
||||
"base64(resourceGroup().location)",
|
||||
"''')\n'",
|
||||
)
|
||||
|
||||
parts = append(parts,
|
||||
fmt.Sprintf("'SUBSCRIPTIONID=$(base64 -d <<<'''"),
|
||||
fmt.Sprintf("base64(subscription().subscriptionId)"),
|
||||
"'SUBSCRIPTIONID=$(base64 -d <<<'''",
|
||||
"base64(subscription().subscriptionId)",
|
||||
"''')\n'",
|
||||
)
|
||||
|
||||
parts = append(parts,
|
||||
fmt.Sprintf("'RESOURCEGROUPNAME=$(base64 -d <<<'''"),
|
||||
fmt.Sprintf("base64(resourceGroup().name)"),
|
||||
"'RESOURCEGROUPNAME=$(base64 -d <<<'''",
|
||||
"base64(resourceGroup().name)",
|
||||
"''')\n'",
|
||||
)
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ func TestAdminListOpenShiftCluster(t *testing.T) {
|
|||
type test struct {
|
||||
name string
|
||||
mocks func(*gomock.Controller, *mock_database.MockOpenShiftClusters, *mock_clusterdata.MockOpenShiftClusterEnricher, *mock_encryption.MockCipher)
|
||||
skipToken string
|
||||
wantStatusCode int
|
||||
wantResponse []*admin.OpenShiftCluster
|
||||
wantError string
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"testing"
|
||||
|
||||
operatorv1 "github.com/openshift/api/operator/v1"
|
||||
v1 "github.com/openshift/api/operator/v1"
|
||||
"github.com/openshift/client-go/operator/clientset/versioned/fake"
|
||||
"github.com/sirupsen/logrus"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -21,16 +20,16 @@ func TestUpdateConsoleBranding(t *testing.T) {
|
|||
|
||||
i := &Installer{
|
||||
log: logrus.NewEntry(logrus.StandardLogger()),
|
||||
operatorcli: fake.NewSimpleClientset(&v1.Console{
|
||||
operatorcli: fake.NewSimpleClientset(&operatorv1.Console{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: consoleName,
|
||||
},
|
||||
Status: v1.ConsoleStatus{
|
||||
OperatorStatus: v1.OperatorStatus{
|
||||
Conditions: []v1.OperatorCondition{
|
||||
Status: operatorv1.ConsoleStatus{
|
||||
OperatorStatus: operatorv1.OperatorStatus{
|
||||
Conditions: []operatorv1.OperatorCondition{
|
||||
{
|
||||
Type: "DeploymentAvailable",
|
||||
Status: v1.ConditionTrue,
|
||||
Status: operatorv1.ConditionTrue,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -12,11 +12,6 @@ import (
|
|||
"github.com/Azure/ARO-RP/pkg/metrics"
|
||||
)
|
||||
|
||||
type metric struct {
|
||||
t time.Time
|
||||
name string
|
||||
}
|
||||
|
||||
var _ k8smetrics.LatencyMetric = (*tracer)(nil)
|
||||
var _ k8smetrics.ResultMetric = (*tracer)(nil)
|
||||
|
||||
|
|
|
@ -55,9 +55,6 @@ func NewManager(_env env.Interface, billing database.Billing, sub database.Subsc
|
|||
}
|
||||
|
||||
e2estorage := storage.NewAccountsClient(_env.E2EStorageAccountSubID(), localFPAuthorizer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
keys, err := e2estorage.ListKeys(context.Background(), _env.E2EStorageAccountRGName(), _env.E2EStorageAccountName(), "")
|
||||
if err != nil {
|
||||
|
|
|
@ -67,8 +67,12 @@ func (ef *workerProfilesEnricherTask) FetchData(callbacks chan<- func(), errs ch
|
|||
return
|
||||
}
|
||||
|
||||
workerProfiles := make([]api.WorkerProfile, len(machinesets.Items), len(machinesets.Items))
|
||||
workerProfiles := make([]api.WorkerProfile, len(machinesets.Items))
|
||||
for i, machineset := range machinesets.Items {
|
||||
if machineset.Spec.Template.Spec.ProviderSpec.Value == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
o, _, err := codecs.UniversalDeserializer().Decode(machineset.Spec.Template.Spec.ProviderSpec.Value.Raw, nil, nil)
|
||||
if err != nil {
|
||||
ef.log.Error(err)
|
||||
|
|
Загрузка…
Ссылка в новой задаче