cloud-init icon indicating copy to clipboard operation
cloud-init copied to clipboard

ds-identify: Improve ds-identify testing flexibility

Open holmanb opened this issue 1 year ago • 0 comments

ds-identify: Improve ds-identify testing flexibility

- DI_MAIN: if DI_MAIN isn't a builtin function, exec() it
- /usr/libexec/ds-identify-env may be sourced to set variables

The purpose of these changes is to improve ds-identify testing capabilities and to allow testing alternative ds-identify implementations. Use of these capabilities is not supported in cloud-init deployments and therefore generates warnings in the ds-identify log.

Systemd gives generators no ability to run with custom environment variables. To set ds-identify variables at runtime, sourcing an environment file is required.

Example no-op side-loading:

    $ DI_MAIN='echo' ./tools/ds-identify "hello world"
    WARN: side-loading alternate implementation: [echo]
    hello world

Example side-loader that can only identify one cloud:

    $ cat nocloud-identifier.sh
    #!/bin/sh
    echo "creating nocloud config"
    echo "datasource_list: [ NoCloud ]" > cloud.cfg
    $ DI_MAIN=./nocloud-identifier.sh ./tools/ds-identify
    WARN: side-loading alternate implementation: [./nocloud-identifier.sh]
    creating nocloud config
    $ cat cloud.cfg
    datasource_list: [ NoCloud ]

Merge type

  • [ ] Squash merge using "Proposed Commit Message"
  • [x] Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

holmanb avatar Mar 12 '24 17:03 holmanb