Can you put multiline values in gadget default?

Hey there,

We want to set a default value for ubuntu-frame display variable. However, the contents of this variable is a complete configuration file…

I tried adding this section to my gadget yaml:

defaults:
  BPZbvWzvoMTrpec4goCXlckLe2IhfthK:
    display: '''
  layouts:
  default:
    cards:
    - card-id: 0
      eDP-1:
        # This output supports the following modes: 1280x800@60.0
        #
        # Uncomment the following to enforce the selected configuration.
        # Or amend as desired.
        #
        state: enabled	# {enabled, disabled}, defaults to enabled
        mode: 1280x800@60.0	# Defaults to preferred mode
        position: [0, 0]	# Defaults to [0, 0]
        orientation: right	# {normal, left, right, inverted}, defaults to normal
        scale: 1
        group: 0	# Outputs with the same non-zero value are treated as a single display

      HDMI-A-1:
        # (disconnected)

      DisplayPort-1:
        # (disconnected)
'''

But when reading it inside the booted image all the newline seem to be stripped:

charlee-clay@ubuntu:~$ snap get ubuntu-frame display
'layouts:\n default:\n cards:\n - card-id: 0 \n eDP-1: # This output supports the following modes: 1280x800@60.0 # # Uncomment the following to enforce the selected configuration. # Or amend as desired. # state: enabled	# {enabled, disabled}, defaults to enabled mode: 1280x800@60.0	# Defaults to preferred mode position: [0, 0]	# Defaults to [0, 0] orientation: right	# {normal, left, right, inverted}, defaults to normal scale: 1 group: 0	# Outputs with the same non-zero value are treated as a single display
HDMI-A-1: # (disconnected)
DisplayPort-1: # (disconnected) '

And ubuntu frame fails to parse the file:

2024-03-18T16:40:17Z ubuntu-frame.daemon[5219]: ERROR: in display configuration file: '/var/snap/ubuntu-frame/8587/frame.display' : unrecognized content
2024-03-18T16:40:17Z systemd[1]: snap.ubuntu-frame.daemon.service: Main process exited, code=exited, status=1/FAILURE
2024-03-18T16:40:17Z systemd[1]: snap.ubuntu-frame.daemon.service: Failed with result 'exit-code'.

Is there a way to somehow give a multiline variable as a default?

Using core22.

I doubt triple single quotes is valid yaml :slightly_smiling_face:

Perhaps this helps ?

https://yaml-multiline.info/