Skip to content

Commit

Permalink
Fixed some more typos. (#445)
Browse files Browse the repository at this point in the history
* Fix typos.

---------

Co-authored-by: Jenna Goldstrich <jenna.goldstrich@hashicorp.com>
  • Loading branch information
lzandman and JenGoldstrich authored Oct 29, 2024
1 parent 93909bc commit 3308e28
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 45 deletions.
6 changes: 3 additions & 3 deletions builder/azure/arm/builder_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(`
{
Expand Down
2 changes: 1 addition & 1 deletion builder/azure/arm/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
10 changes: 5 additions & 5 deletions builder/azure/arm/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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,
Expand Down
40 changes: 20 additions & 20 deletions builder/azure/arm/step_deploy_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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{}
Expand Down Expand Up @@ -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"+
Expand Down Expand Up @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions builder/azure/arm/step_deploy_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion builder/azure/chroot/diskattacher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions builder/azure/chroot/step_attach_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions builder/azure/chroot/step_create_new_diskset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion builder/azure/common/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion builder/azure/dtl/builder_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions builder/azure/dtl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion docs/builders/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions provisioner/azure-dtlartifact/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packe
}
}

dtlApplyArifactRequest := virtualmachines.ApplyArtifactsRequest{
dtlApplyArtifactRequest := virtualmachines.ApplyArtifactsRequest{
Artifacts: &dtlArtifacts,
}

Expand All @@ -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))
Expand Down

0 comments on commit 3308e28

Please sign in to comment.