From 1ffdb1fdf0ccad8a3091e2a761faf06fdb096a33 Mon Sep 17 00:00:00 2001 From: Leon Zandman Date: Thu, 3 Oct 2024 17:17:11 +0200 Subject: [PATCH] Fix typos. --- builder/azure/arm/builder_acc_test.go | 6 +++--- builder/azure/arm/builder_test.go | 2 +- builder/azure/arm/config_test.go | 10 +++++----- builder/azure/arm/step_deploy_template.go | 10 +++++----- builder/azure/arm/step_deploy_template_test.go | 4 ++-- builder/azure/chroot/diskattacher.go | 2 +- .../azure/chroot/shared_image_gallery_destination.go | 4 ++-- .../shared_image_gallery_destination.hcl2spec.go | 4 ++-- .../chroot/shared_image_gallery_destination_test.go | 4 ++-- builder/azure/chroot/step_attach_disk.go | 6 +++--- builder/azure/chroot/step_create_new_diskset.go | 6 +++--- builder/azure/common/client/config.go | 2 +- builder/azure/dtl/builder_acc_test.go | 2 +- builder/azure/dtl/config.go | 4 ++-- docs/builders/index.mdx | 2 +- provisioner/azure-dtlartifact/provisioner.go | 4 ++-- 16 files changed, 36 insertions(+), 36 deletions(-) diff --git a/builder/azure/arm/builder_acc_test.go b/builder/azure/arm/builder_acc_test.go index 4a0b68b9..bb55de79 100644 --- a/builder/azure/arm/builder_acc_test.go +++ b/builder/azure/arm/builder_acc_test.go @@ -5,9 +5,9 @@ package arm // Below are the requirements for running the acceptance tests for the Packer Azure plugin ARM Builder // -// * An Azure subscription, with a resource group, app registration based credentails and a few image galleries +// * An Azure subscription, with a resource group, app registration based credentials and a few image galleries // You can use the Terraform config in the terraform folder at the base of the repository -// It is reccomended to set the required environment variables and then run the acceptance_test_setup.sh script in the terraform directory +// It is recommended to set the required environment variables and then run the acceptance_test_setup.sh script in the terraform directory // // * The Azure CLI installed and logged in for testing CLI based authentication // * Env Variables for Auth @@ -328,7 +328,7 @@ func deleteGalleryVersions(t *testing.T, subscriptionID string, resourceGroupNam } } -// TODO Move these templates to seperate files inside the testdata directory rather than defined strings here +// TODO Move these templates to separate files inside the testdata directory rather than defined strings here func testBuilderUserDataLinux(userdata string) string { return fmt.Sprintf(` { diff --git a/builder/azure/arm/builder_test.go b/builder/azure/arm/builder_test.go index 8f46525a..a310fbf4 100644 --- a/builder/azure/arm/builder_test.go +++ b/builder/azure/arm/builder_test.go @@ -39,7 +39,7 @@ func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) { } } -func TestStateBagShouldPoluateExpectedTags(t *testing.T) { +func TestStateBagShouldPopulateExpectedTags(t *testing.T) { var testSubject Builder expectedTags := map[string]string{ diff --git a/builder/azure/arm/config_test.go b/builder/azure/arm/config_test.go index 82f98c9c..8438c8f0 100644 --- a/builder/azure/arm/config_test.go +++ b/builder/azure/arm/config_test.go @@ -1084,7 +1084,7 @@ func TestConfigZoneResilientShouldDefaultToFalse(t *testing.T) { "managed_image_name": "ignore", "managed_image_resource_group_name": "ignore", "build_resource_group_name": "ignore", - "image_publisher": "igore", + "image_publisher": "ignore", "image_offer": "ignore", "image_sku": "ignore", "os_type": "linux", @@ -1107,7 +1107,7 @@ func TestConfigZoneResilientSetFromConfig(t *testing.T) { "managed_image_name": "ignore", "managed_image_resource_group_name": "ignore", "build_resource_group_name": "ignore", - "image_publisher": "igore", + "image_publisher": "ignore", "image_offer": "ignore", "image_sku": "ignore", "os_type": "linux", @@ -3085,7 +3085,7 @@ func TestConfigShouldRejectCVMSourceToBuildManagedImage(t *testing.T) { } func TestConfigShouldRejectNonMatchingSecurityType(t *testing.T) { - invaidSecurityType := "ignore" + invalidSecurityType := "ignore" config := map[string]interface{}{ "image_offer": "ignore", "image_publisher": "ignore", @@ -3094,14 +3094,14 @@ func TestConfigShouldRejectNonMatchingSecurityType(t *testing.T) { "subscription_id": "ignore", "communicator": "none", "managed_image_name": "ignore", - "managed_image_resource_group_name": invaidSecurityType, + "managed_image_resource_group_name": invalidSecurityType, "os_type": constants.Target_Linux, // Does not matter for this test case, just pick one. "security_type": "ignore", } var c Config _, err := c.Prepare(config, getPackerConfiguration()) - errorMessage := fmt.Sprintf(`The security_type "%s" must match either "TrustedLaunch" or "ConfidentialVM".`, invaidSecurityType) + errorMessage := fmt.Sprintf(`The security_type "%s" must match either "TrustedLaunch" or "ConfidentialVM".`, invalidSecurityType) if err == nil { t.Fatalf("expected config to reject with the following error: %q", errorMessage, diff --git a/builder/azure/arm/step_deploy_template.go b/builder/azure/arm/step_deploy_template.go index 511073d5..46e78f9b 100644 --- a/builder/azure/arm/step_deploy_template.go +++ b/builder/azure/arm/step_deploy_template.go @@ -39,7 +39,7 @@ const ( type StepDeployTemplate struct { client *AzureClient deploy func(ctx context.Context, subscriptionId string, resourceGroupName string, deploymentName string) error - deleteDetatchedResources func(ctx context.Context, subscriptionId string, resourceGroupName string, resources map[string]string) + deleteDetachedResources func(ctx context.Context, subscriptionId string, resourceGroupName string, resources map[string]string) getDisk func(ctx context.Context, subscriptionId string, resourceGroupName string, computeName string) (string, string, error) deleteDisk func(ctx context.Context, imageName string, resourceGroupName string, isManagedDisk bool, subscriptionId string, storageAccountName string) error deleteVM func(ctx context.Context, virtualMachineId virtualmachines.VirtualMachineId) error @@ -69,7 +69,7 @@ func NewStepDeployTemplate(client *AzureClient, ui packersdk.Ui, config *Config, step.deploy = step.deployTemplate step.getDisk = step.getImageDetails step.deleteDisk = step.deleteImage - step.deleteDetatchedResources = step.deleteDetatchedResourcesWithQueue + step.deleteDetachedResources = step.deleteDetachedResourcesWithQueue step.deleteDeployment = step.deleteDeploymentObject step.deleteNic = step.deleteNetworkInterface step.deleteVM = step.deleteVirtualMachine @@ -156,7 +156,7 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) { deploymentOperations, err := s.listDeploymentOps(ctx, deploymentOpsId) if err != nil { - ui.Error(fmt.Sprintf("Could not retrieve deployment operations: %s\n Virtual Machine %s, and its please manually delete it and its ascoiated resources", err, computeName)) + ui.Error(fmt.Sprintf("Could not retrieve deployment operations: %s\n Virtual Machine %s, and its please manually delete it and its associated resources", err, computeName)) return } resources := map[string]string{} @@ -197,7 +197,7 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) { return } } - s.deleteDetatchedResources(ctx, subscriptionId, resourceGroupName, resources) + s.deleteDetachedResources(ctx, subscriptionId, resourceGroupName, resources) // The disk was not found on the VM, this is an error. if imageType == "" && imageName == "" { ui.Error(fmt.Sprintf("Failed to find temporary OS disk on VM. Please delete manually.\n\n"+ @@ -394,7 +394,7 @@ func (s *StepDeployTemplate) listDeploymentOperations(ctx context.Context, id de // This function is called to delete the resources remaining in the deployment after we delete the Virtual Machine and the deleteNic // These resources before the VM and the NIC results in errors -func (s *StepDeployTemplate) deleteDetatchedResourcesWithQueue(ctx context.Context, subscriptionId string, resourceGroupName string, resources map[string]string) { +func (s *StepDeployTemplate) deleteDetachedResourcesWithQueue(ctx context.Context, subscriptionId string, resourceGroupName string, resources map[string]string) { var wg sync.WaitGroup wg.Add(len(resources)) diff --git a/builder/azure/arm/step_deploy_template_test.go b/builder/azure/arm/step_deploy_template_test.go index f74ce3ec..5c7d0cf0 100644 --- a/builder/azure/arm/step_deploy_template_test.go +++ b/builder/azure/arm/step_deploy_template_test.go @@ -229,7 +229,7 @@ func TestStepDeployTemplateCleanupShouldDeleteVirtualMachineAndNetworkResourcesI testSubject.listDeploymentOps = func(ctx context.Context, id deploymentoperations.ResourceGroupDeploymentId) ([]deploymentoperations.DeploymentOperation, error) { return virtualMachineWithNetworkingDeploymentOperations(), nil } - testSubject.deleteDetatchedResources = func(ctx context.Context, subscriptionId, resourceGroupName string, resources map[string]string) { + testSubject.deleteDetachedResources = func(ctx context.Context, subscriptionId, resourceGroupName string, resources map[string]string) { if mockTrackers.vmDeleteCalled == nil || *mockTrackers.vmDeleteCalled == false { t.Fatal("deleteNetworkResources called before deleting VM, this will lead to deletion conflicts") } @@ -393,7 +393,7 @@ func createTestStepDeployTemplateDeleteOSImage(t *testing.T, trackers *mockTrack trackers.deleteNicCalled = common.BoolPtr(true) return nil }, - deleteDetatchedResources: func(ctx context.Context, subscriptionId string, resourceGroupName string, resources map[string]string) { + deleteDetachedResources: func(ctx context.Context, subscriptionId string, resourceGroupName string, resources map[string]string) { if len(resources) != 0 { trackers.actualNetworkResources = &resources } diff --git a/builder/azure/chroot/diskattacher.go b/builder/azure/chroot/diskattacher.go index c6de2ccc..577bd05c 100644 --- a/builder/azure/chroot/diskattacher.go +++ b/builder/azure/chroot/diskattacher.go @@ -53,7 +53,7 @@ func (da *diskAttacher) DetachDisk(ctx context.Context, diskID string) error { for _, disk := range currentDisks { if disk.ManagedDisk != nil { if disk.ManagedDisk.Id == nil { - log.Println("DetatchDisks failure: Azure Client returned a disk without an ID") + log.Println("DetachDisks failure: Azure Client returned a disk without an ID") return AzureAPIDiskError } if !strings.EqualFold(*disk.ManagedDisk.Id, diskID) { diff --git a/builder/azure/chroot/shared_image_gallery_destination.go b/builder/azure/chroot/shared_image_gallery_destination.go index 0980a40d..9d3d35d2 100644 --- a/builder/azure/chroot/shared_image_gallery_destination.go +++ b/builder/azure/chroot/shared_image_gallery_destination.go @@ -21,7 +21,7 @@ type SharedImageGalleryDestination struct { TargetRegions []TargetRegion `mapstructure:"target_regions"` ExcludeFromLatest bool `mapstructure:"exclude_from_latest"` - ExcludeFromLatestTypo bool `mapstructure:"exlude_from_latest" undocumented:"true"` + ExcludeFromLatestTypo bool `mapstructure:"exclude_from_latest" undocumented:"true"` } // TargetRegion describes a region where the shared image should be replicated @@ -67,7 +67,7 @@ func (sigd *SharedImageGalleryDestination) Validate(prefix string) (errs []error } if sigd.ExcludeFromLatestTypo == true && sigd.ExcludeFromLatest == false { warns = append(warns, - fmt.Sprintf("%s.exlude_from_latest is being deprecated, please use exclude_from_latest", prefix)) + fmt.Sprintf("%s.exclude_from_latest is being deprecated, please use exclude_from_latest", prefix)) sigd.ExcludeFromLatest = sigd.ExcludeFromLatestTypo } return diff --git a/builder/azure/chroot/shared_image_gallery_destination.hcl2spec.go b/builder/azure/chroot/shared_image_gallery_destination.hcl2spec.go index 7ffd151d..de1dc32c 100644 --- a/builder/azure/chroot/shared_image_gallery_destination.hcl2spec.go +++ b/builder/azure/chroot/shared_image_gallery_destination.hcl2spec.go @@ -16,7 +16,7 @@ type FlatSharedImageGalleryDestination struct { ImageVersion *string `mapstructure:"image_version" required:"true" cty:"image_version" hcl:"image_version"` TargetRegions []FlatTargetRegion `mapstructure:"target_regions" cty:"target_regions" hcl:"target_regions"` ExcludeFromLatest *bool `mapstructure:"exclude_from_latest" cty:"exclude_from_latest" hcl:"exclude_from_latest"` - ExcludeFromLatestTypo *bool `mapstructure:"exlude_from_latest" undocumented:"true" cty:"exlude_from_latest" hcl:"exlude_from_latest"` + ExcludeFromLatestTypo *bool `mapstructure:"exclude_from_latest" undocumented:"true" cty:"exclude_from_latest" hcl:"exclude_from_latest"` } // FlatMapstructure returns a new FlatSharedImageGalleryDestination. @@ -37,7 +37,7 @@ func (*FlatSharedImageGalleryDestination) HCL2Spec() map[string]hcldec.Spec { "image_version": &hcldec.AttrSpec{Name: "image_version", Type: cty.String, Required: false}, "target_regions": &hcldec.BlockListSpec{TypeName: "target_regions", Nested: hcldec.ObjectSpec((*FlatTargetRegion)(nil).HCL2Spec())}, "exclude_from_latest": &hcldec.AttrSpec{Name: "exclude_from_latest", Type: cty.Bool, Required: false}, - "exlude_from_latest": &hcldec.AttrSpec{Name: "exlude_from_latest", Type: cty.Bool, Required: false}, + "exclude_from_latest": &hcldec.AttrSpec{Name: "exclude_from_latest", Type: cty.Bool, Required: false}, } return s } diff --git a/builder/azure/chroot/shared_image_gallery_destination_test.go b/builder/azure/chroot/shared_image_gallery_destination_test.go index 7c9cd7f7..d2d047d5 100644 --- a/builder/azure/chroot/shared_image_gallery_destination_test.go +++ b/builder/azure/chroot/shared_image_gallery_destination_test.go @@ -71,7 +71,7 @@ func TestSharedImageGalleryDestination_Validate(t *testing.T) { wantWarns: []string{"sigdest.target_regions is empty; image will only be available in the region of the gallery"}, }, { - name: "warn if using exlude_from_latest", + name: "warn if using exclude_from_latest", fields: fields{ ResourceGroup: "ResourceGroup", GalleryName: "GalleryName", @@ -91,7 +91,7 @@ func TestSharedImageGalleryDestination_Validate(t *testing.T) { }, ExcludeFromLatestTypo: true, }, - wantWarns: []string{"sigdest.exlude_from_latest is being deprecated, please use exclude_from_latest"}, + wantWarns: []string{"sigdest.exclude_from_latest is being deprecated, please use exclude_from_latest"}, }, { name: "version format", diff --git a/builder/azure/chroot/step_attach_disk.go b/builder/azure/chroot/step_attach_disk.go index 78299f61..ffe27905 100644 --- a/builder/azure/chroot/step_attach_disk.go +++ b/builder/azure/chroot/step_attach_disk.go @@ -78,9 +78,9 @@ func (s *StepAttachDisk) CleanupFunc(state multistep.StateBag) error { ui.Say(fmt.Sprintf("Detaching disk '%s'", diskResourceID)) da := NewDiskAttacher(azcli, ui) - detatchDisk, detatchDiskCancel := context.WithTimeout(context.Background(), azcli.PollingDuration()) - defer detatchDiskCancel() - err := da.DetachDisk(detatchDisk, diskResourceID) + detachDisk, detachDiskCancel := context.WithTimeout(context.Background(), azcli.PollingDuration()) + defer detachDiskCancel() + err := da.DetachDisk(detachDisk, diskResourceID) if err != nil { return fmt.Errorf("error detaching %q: %v", diskResourceID, err) } diff --git a/builder/azure/chroot/step_create_new_diskset.go b/builder/azure/chroot/step_create_new_diskset.go index b6192da0..ba22cbe3 100644 --- a/builder/azure/chroot/step_create_new_diskset.go +++ b/builder/azure/chroot/step_create_new_diskset.go @@ -239,9 +239,9 @@ func (s *StepCreateNewDiskset) Cleanup(state multistep.StateBag) { for _, d := range s.disks { ui.Say(fmt.Sprintf("Waiting for disk %q detach to complete", d)) - detatchDisk, detatchDiskCancel := context.WithTimeout(context.Background(), azcli.PollingDuration()) - defer detatchDiskCancel() - err := NewDiskAttacher(azcli, ui).WaitForDetach(detatchDisk, d.String()) + detachDisk, detachDiskCancel := context.WithTimeout(context.Background(), azcli.PollingDuration()) + defer detachDiskCancel() + err := NewDiskAttacher(azcli, ui).WaitForDetach(detachDisk, d.String()) if err != nil { ui.Error(fmt.Sprintf("error detaching disk %q: %s", d, err)) } diff --git a/builder/azure/common/client/config.go b/builder/azure/common/client/config.go index 55827609..f4329b4f 100644 --- a/builder/azure/common/client/config.go +++ b/builder/azure/common/client/config.go @@ -112,7 +112,7 @@ const ( const DefaultCloudEnvironmentName = "Public" // CloudEnvironmentName is deprecated in favor of MetadataHost. This is retained -// for now to preserve backward compatability, but should eventually be removed. +// for now to preserve backward compatibility, but should eventually be removed. func (c *Config) SetDefaultValues() error { if c.CloudEnvironmentName == "" { c.CloudEnvironmentName = DefaultCloudEnvironmentName diff --git a/builder/azure/dtl/builder_acc_test.go b/builder/azure/dtl/builder_acc_test.go index da180067..2668cd41 100644 --- a/builder/azure/dtl/builder_acc_test.go +++ b/builder/azure/dtl/builder_acc_test.go @@ -13,7 +13,7 @@ package dtl // Your resource group should be the South Central US region // This test also requires a DTL (Dev Test Lab) named `(ARM_RESOURCE_PREFIX)-packer_acceptance_test` // This can be created using the terraform config in the `terraform` folder at the root of this repo -// It is reccomended to set the required environment variables and then run the acceptance_test_setup.sh script in the terraform directory +// It is recommended to set the required environment variables and then run the acceptance_test_setup.sh script in the terraform directory // In addition, the PACKER_ACC variable should also be set to // a non-empty value to enable Packer acceptance tests and the // options "-v -timeout 90m" should be provided to the test diff --git a/builder/azure/dtl/config.go b/builder/azure/dtl/config.go index 8abba7bd..8394bb9d 100644 --- a/builder/azure/dtl/config.go +++ b/builder/azure/dtl/config.go @@ -395,8 +395,8 @@ func (c *Config) createCertificate() (string, string, error) { return "", "", err } - certifcatePassowrd := base64.StdEncoding.EncodeToString([]byte(c.tmpCertificatePassword)) - return base64.StdEncoding.EncodeToString(bytes), certifcatePassowrd, nil + certifcatePassword := base64.StdEncoding.EncodeToString([]byte(c.tmpCertificatePassword)) + return base64.StdEncoding.EncodeToString(bytes), certifcatePassword, nil } func (c *Config) Prepare(raws ...interface{}) ([]string, error) { diff --git a/docs/builders/index.mdx b/docs/builders/index.mdx index c8a3f607..5988f50f 100644 --- a/docs/builders/index.mdx +++ b/docs/builders/index.mdx @@ -41,7 +41,7 @@ following methods are available and are explained below: -> **Don't know which authentication method to use?** -It is reccomended to use 'use_azure_cli_auth' to enable Azure CLI authentication +It is recommended to use 'use_azure_cli_auth' to enable Azure CLI authentication No matter which method you choose, the identity you use will need the appropriate permissions on Azure resources for Packer to operate. The minimal diff --git a/provisioner/azure-dtlartifact/provisioner.go b/provisioner/azure-dtlartifact/provisioner.go index f5e9225f..2384c2ae 100644 --- a/provisioner/azure-dtlartifact/provisioner.go +++ b/provisioner/azure-dtlartifact/provisioner.go @@ -178,7 +178,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packe } } - dtlApplyArifactRequest := virtualmachines.ApplyArtifactsRequest{ + dtlApplyArtifactRequest := virtualmachines.ApplyArtifactsRequest{ Artifacts: &dtlArtifacts, } @@ -187,7 +187,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packe pollingContext, cancel := context.WithTimeout(ctx, azureClient.PollingDuration) defer cancel() vmResourceId := virtualmachines.NewVirtualMachineID(p.config.ClientConfig.SubscriptionID, p.config.ResourceGroupName, p.config.LabName, p.config.VMName) - err = azureClient.DtlMetaClient.VirtualMachines.ApplyArtifactsThenPoll(pollingContext, vmResourceId, dtlApplyArifactRequest) + err = azureClient.DtlMetaClient.VirtualMachines.ApplyArtifactsThenPoll(pollingContext, vmResourceId, dtlApplyArtifactRequest) if err != nil { ui.Say(fmt.Sprintf("Error Applying artifact: %s", err))