- # As we need the UUID generated in the previous command, we need to
- # iterate again in order to get them
- {% set vm_uuid = salt['cmd.shell'](cmd_query_vm_uuid) %}
-
- {%- set scoped_token_url = '/arvados/v1/virtual_machines/' ~ vm_uuid ~ '/logins' %}
+# We need to use the UUID generated in the previous command to see if there's a
+# scoped token for it. There's no easy way to pass the value from a shellout
+# to another state, so we store it in a temp file and use that in the next
+# command. Flaky, mostly because the `unless` clause is just checking thatg
+# the file content is a token uuid :|
+arvados-controller-resources-virtual-machines-{{ vm }}-get-vm_uuid-cmd-run:
+ cmd.run:
+ - name: {{ cmd_query_vm_uuid }} | head -1 | tee /tmp/{{ vm }}
+ - require:
+ - cmd: arvados-controller-resources-virtual-machines-{{ vm }}-record-cmd-run
+ - unless:
+ - /bin/grep -qE "fixme-2x53u-[a-z0-9]{15}" /tmp/{{ vm }}