snap.yaml app command doesn't allow "=", ":"

Bug #1827392 reported by Ian Johnson
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
snapd
Confirmed
Medium
Unassigned

Bug Description

For example, with a statically compiled go program such as vault installed to $SNAP/bin/vault, the following yaml is not allowed by snapd:

```
apps:
  vault:
    command: bin/vault server --config=$VAULT_CONFIG
    daemon: simple
    environment:
      VAULT_CONFIG: "$SNAP_DATA/config/security-secret-store/vault-config.json"
      VAULT_ADDR: "https://localhost:8200"
      VAULT_UI: "true"
    plugs:
      - network
      - network-bind
```

The following message is returned from snapcraft:

error: cannot validate snap "edgexfoundry": invalid definition of application "vault": app description field 'command' contains illegal "bin/vault server --config=$VAULT_CONFIG" (legal: '^[A-Za-z0-9/. _#:$-]*$')

I think that "=" should be added to the list of allowed symbols and that the message could be worded better, something like

invalid definition of application "vault": app description field 'command' is illegal with "bin/vault server --config=$VAULT_CONFIG" (legal: '^[A-Za-z0-9/. _#:$-]*$')

or if it has the ability to highlight exactly what is wrong about the field:

invalid definition of application "vault": app description field 'command' "bin/vault server --config=$VAULT_CONFIG" contains illegal character "=" (legal: '^[A-Za-z0-9/. _#:$-]*$')

or something else because as it is, it doesn't say exactly what is illegal about the specification and it took me a while to see that the "=" is not allowed (which I also think it should be as specifying the value of an option with an "=" is a common thing to do

(also note that yes this is using snapcraft, but I am specifying `adapter: none` in the snapcraft.yaml because it's a statically compiled go program so I don't need the snapcraft wrappers for this)

Revision history for this message
Ian Johnson (anonymouse67) wrote :

Additionally, in this same vein it would be very useful to be able to specify arguments with ":" in them, i.e. to specify the address to connect to for another app in the same snap, we need to do this:

```
command: bin/device-random -confdir $SNAP_DATA/config/device-random -profile res --registry $CONSUL_ADDR
    environment:
      CONSUL_ADDR: "consul://localhost:8500"
```

Where ideally we would just be able to do:

```
command: bin/device-random -confdir $SNAP_DATA/config/device-random -profile res --registry=consul://localhost:8500
```

summary: - snap.yaml app command doesn't allow "="
+ snap.yaml app command doesn't allow "=", ":"
Changed in snapd:
status: New → Triaged
importance: Undecided → High
Zygmunt Krynicki (zyga)
Changed in snapd:
importance: High → Medium
status: Triaged → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.