From 3308e28cf5e325a5b739a361556e8b90341707c0 Mon Sep 17 00:00:00 2001 From: Leon Zandman Date: Tue, 29 Oct 2024 18:25:37 +0100 Subject: [PATCH] Fixed some more typos. (#445) * Fix typos. --------- Co-authored-by: Jenna Goldstrich --- 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 | 40 +++++++++---------- .../azure/arm/step_deploy_template_test.go | 4 +- builder/azure/chroot/diskattacher.go | 2 +- builder/azure/chroot/step_attach_disk.go | 6 +-- .../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 +- 13 files changed, 45 insertions(+), 45 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..d57802e7 100644 --- a/builder/azure/arm/step_deploy_template.go +++ b/builder/azure/arm/step_deploy_template.go @@ -37,22 +37,22 @@ 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) - 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 - deleteNic func(ctx context.Context, networkInterfacesId commonids.NetworkInterfaceId) error - deleteDeployment func(ctx context.Context, state multistep.StateBag) error - deleteKV func(ctx context.Context, id commonids.KeyVaultId) error - listDeploymentOps func(ctx context.Context, id deploymentoperations.ResourceGroupDeploymentId) ([]deploymentoperations.DeploymentOperation, error) - say func(message string) - error func(e error) - config *Config - factory templateFactoryFunc - name string - templateType DeploymentTemplateType + client *AzureClient + deploy func(ctx context.Context, subscriptionId string, resourceGroupName string, deploymentName string) error + 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 + deleteNic func(ctx context.Context, networkInterfacesId commonids.NetworkInterfaceId) error + deleteDeployment func(ctx context.Context, state multistep.StateBag) error + deleteKV func(ctx context.Context, id commonids.KeyVaultId) error + listDeploymentOps func(ctx context.Context, id deploymentoperations.ResourceGroupDeploymentId) ([]deploymentoperations.DeploymentOperation, error) + say func(message string) + error func(e error) + config *Config + factory templateFactoryFunc + name string + templateType DeploymentTemplateType } func NewStepDeployTemplate(client *AzureClient, ui packersdk.Ui, config *Config, deploymentName string, factory templateFactoryFunc, templateType DeploymentTemplateType) *StepDeployTemplate { @@ -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/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))