phileas fogg
phileas fogg

Reputation: 1933

Can wildcards be used in yaml?

I am setting up an automated deployment system that uses Pogo. It stores pass-phrases for encrypted packages in a yaml file. However I'm running into a problem where, although the package name is in the yaml file with the correct pass phrase, it is not being picked up because there is a version number attached to the package name.

For instance, the yaml file will look like this:

somesoftwarepackage: apassphrase

During the automated deployment the actual package name being installed will be something like:

somesoftwarepackage-1.0.23

And the deployment then freezes at that point waiting for a pass-phrase.

Is it possible to use wildcard in yaml so that I can put the generic package name but not have to specify (and then constantly update) the specific version?

Upvotes: 1

Views: 14996

Answers (1)

marshall.ward
marshall.ward

Reputation: 7198

I think the answer is no, YAML cannot do string concatenation, or any other generation or manipulation of data.

The closest thing to variables or wildcards are anchors, which are more like aliases to previously specified data. I guess you could do something like this:

pkg_name: &name my_pkg
pkg_version: &version 1.0.23
pkg_fullname: [ *name, '-', *version ]

so that you have at least documented the package name format (${name}-${version}), and manipulate pkg_fullname into a single string (e.g., ''.join(pkg_fullname) in Python). But it's probably just as easy to do these manipulations with the original data.

Upvotes: 4

Related Questions