Skip to content

Commit

Permalink
Fix typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
lzandman committed Oct 3, 2024
1 parent 93909bc commit 1ffdb1f
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 36 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
10 changes: 5 additions & 5 deletions builder/azure/arm/step_deploy_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions builder/azure/chroot/shared_image_gallery_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions builder/azure/chroot/shared_image_gallery_destination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
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 1ffdb1f

Please sign in to comment.