i dont think there is a snap command to get the managed state (there is
"snap known system-user" but that seems to only work if the user was
actually created with an assertion)

if you actually want shell instead of a simple python http query:

root@pi4:~# cat is-managed.sh 
#! /bin/sh

query_snapd() {
  RET="$(/bin/echo -e 'GET /v2/'"$1"' HTTP/1.0\r\n\r\n' | \
           nc -U /var/run/snapd.socket -q0 2>&1 | \
           grep -oP '(^.*"'"$2"'":)[^,]*' | \
           grep -o '[^:]*$')"
  echo "$RET" | sed 's/\]//g;s/\}//g;s/\"//g'
}

echo "System is managed: $(query_snapd system-info managed)"
echo "By user: $(query_snapd users email)"
root@pi4:~# ./is-managed.sh 
System is managed: true
By user: [email protected]

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1881588

Title:
  pre-seeding lxd on Core appliances breaks console-conf user creation

To manage notifications about this bug go to:
https://bugs.launchpad.net/snapd/+bug/1881588/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to