saltstack-formulas / lxd-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
21 stars 17 forks source link

profile config is not properly serialized #19

Closed simpoir closed 4 years ago

simpoir commented 4 years ago

Bug details

lxd.profiles and lxd.containers don't properly escape config values.

Steps to reproduce the bug

pillars:
  lxd:
    profiles:
      local:
        my_profile:
          config:
            user.user-data: |
              #cloud-config
              ssh_authorized_keys:
                - "ssh-rsa AAAA..."

Then run state.highstate You'll get something like this

$ lxc profile show my_profile
config:
  user.user-data: '#cloud-config\nssh_authorized_keys:\n  - "ssh-rsa AAAA..."'

At first glance the config looks equivalent, but the escaped newlines are single-quoted, which means they will not get reinterpreted as newlines.

Expected behaviour

$ lxc profile show my_profile
config:
  user.user-data: |
    #cloud-config
    ssh_authorized_keys:
      - "ssh-rsa AAAA..."
myii commented 4 years ago

@simpoir Apologies for the delay and thanks for the contribution -- merged.