Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neither clean_resource_name or clean_omi_name functions are working #167

Open
gamcorn opened this issue Nov 27, 2023 · 0 comments
Open

Neither clean_resource_name or clean_omi_name functions are working #167

gamcorn opened this issue Nov 27, 2023 · 0 comments
Labels

Comments

@gamcorn
Copy link

gamcorn commented Nov 27, 2023

Overview of the Issue

In OSC provider version 1.1.3 when using omi name automatic reformatting functions as specified on packer docs:
mybuild-{{isotime | clean_resource_name}}" will become mybuild-2017-10-18t02-06-30z
will raise an error: function "clean_resource_name" not defined
Replacing clean_resource_name by the Outscale plugin recommended clean_omi_name raises an error: function "clean_omi_name" not defined .

Reproduction Steps

Create a packer configuration with the OSC provider version 1.1.3
Setup timestamp naming on the image name with: omi_name = "$my-base-name-{{isotime | clean_resource_name}}"
Use command 'packer validate .' to validate your build
This will rise an error

Now try with omi_name = "$my-base-name-{{isotime | clean_omi_name}}"
Use command 'packer validate .' to validate your build
This will rise an error

Plugin and Packer version

From packer version 1.9.4

Simplified Packer Buildfile

packer {
  required_plugins {
    outscale = {
      version = ">=v1.1.3"
      source  = "github.com/outscale/outscale"
    }
  }
}

source "outscale-bsu" "my_image" {
    launch_block_device_mappings {
        delete_on_vm_deletion = true
        device_name = "/dev/xvdf"
    }
    source_omi_filter {
        filters = {
            image-name          = "Ubuntu-20.04-2021.02.10-5"
            root-device-type    = "ebs"
            virtualization-type = "hvm"
        }
	    owners = ["Outscale"]
        most_recent = true
    }
    source_omi = "${var.omi}"
}

build {
  name = "worker_image"
  source "source.outscale-bsu.quetzal" {
    omi_name = "worker-{{isotime | clean_resource_name}}"
  }
}

Operating system and Environment details

CENTOS 7 Outscale VM

Log Fragments and crash.log files

Error: invalid 'omi_name': template: root:1: function "clean_resource_name" not defined in:

worker-{{isotime | clean_resource_name}}

  on packer/quetzal_img.pkr.hcl line 28:
  (source code not available)
Error: invalid 'omi_name': template: root:1: function "clean_omi_name" not defined in:

worker-{{isotime | clean_omi_name}}

  on packer/quetzal_img.pkr.hcl line 28:
  (source code not available)

Set the env var `PACKER_LOG=1` for maximum log detail.
@gamcorn gamcorn added the bug label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant