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

Object parameters cannot be read from a file #3257

Open
lbergnehr opened this issue Nov 21, 2024 · 0 comments
Open

Object parameters cannot be read from a file #3257

lbergnehr opened this issue Nov 21, 2024 · 0 comments
Labels
enhancement New code incoming!

Comments

@lbergnehr
Copy link
Contributor

Describe the bug

According to

porter install --param config=./config.json
,
an object parameter should, much like the file type parameter, be able to be
taken from a file directly when specified using the --param option in e.g.
porter install.

To Reproduce

Steps to reproduce the behavior:

  1. Use this porter.yaml:

    schemaType: Bundle
    schemaVersion: 1.0.1
    name: porter-repro
    version: 0.1.0
    description: "An example Porter configuration"
    registry: "localhost:5000"
    
    # Declare and optionally configure the mixins used by the bundle
    mixins:
      - exec
    
    parameters:
      - name: object_parameter
        type: object
        path: /cnab/app/object_parameter.json
    
    # Define the steps that should execute when the bundle is installed
    install:
      - exec:
          description: "Install Hello World"
          command: echo
          arguments:
            - install ${ bundle.parameters.object_parameter }
    
    # Define the steps that should execute when the bundle is upgraded
    upgrade:
      - exec:
          description: "World 2.0"
          command: ./helpers.sh
          arguments:
            - upgrade
    
    # Define the steps that should execute when the bundle is uninstalled
    uninstall:
      - exec:
          description: "Uninstall Hello World"
          command: ./helpers.sh
          arguments:
            - uninstall
  2. Put the following in object_parameter.json:

    {
      "key": "value"
    }
  3. Run porter install --param object_parameter=./object_parameter.json

  4. Observe the error:

    unable to convert parameter's object_parameter value ./object_parameter.json to the destination parameter type object: could not unmarshal value ./object_parameter.json into a json object: invalid character '.' looking for beginning of value
    

Expected behavior

The file should be read and marshalled into the object parameter
representation if the parameter given in the --param option is pointing to a
file.

Version

porter v1.2.0 (45c17c15)
@lbergnehr lbergnehr added the bug Oops, sorry! label Nov 21, 2024
@kichristensen kichristensen added enhancement New code incoming! and removed bug Oops, sorry! labels Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New code incoming!
Projects
None yet
Development

No branches or pull requests

2 participants