Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

UCD executes runcmd entries in the wrong order #29

@markdryan

Description

@markdryan

This can be seen with the tests/runcmd.yaml file which contains the following contents.

#cloud-config
runcmd:
  - [ ls, -l, / ]
  - [ sh, -xc, "echo $(date) ': hello world!'" ]
  - [ sh, -c, echo "=========hello world'=========" ]
  - ls -l /root
  - [ wget, "http://slashdot.org", -O, /tmp/index.html ]

Now look at the ouput of ucd. I also see this behaviour when ucd is running as part of the boot process.

Actually, it's not quite reverse order as it seems that the command not in flow form is executed first

./ucd -u examples/runcmd.yaml
[20051.434582] micro-config-drive version: 30
[20051.435051] userdata: Looking for shebang file /root/micro-config-drive/examples/runcmd.yaml
[20051.435147] userdata: Shebang found #cloud-config

[20051.435194] Parsing user data file /root/micro-config-drive/examples/runcmd.yaml
[20051.435623] Loaded handler for block "package_upgrade"
[20051.435666] Loaded handler for block "write_files"
[20051.435673] Loaded handler for block "packages"
[20051.435681] Loaded handler for block "groups"
[20051.435697] Loaded handler for block "users"
[20051.435708] Loaded handler for block "ssh_authorized_keys"
[20051.435715] Loaded handler for block "service"
[20051.435725] Loaded handler for block "hostname"
[20051.435750] Loaded handler for block "runcmd"
[20051.435768] Loaded handler for block "envar"
[20051.435792] Loaded handler for block "fbootcmd"
[20051.435820] Executing handler for block "runcmd"
[20051.435835] runcmd: runcmd handler running...
[20051.435855] lib: Executing: /bin/bash -c "ls -l /root "
[20051.439425] lib: STD output: total 4
drwxr-xr-x 11 root root 4096 Feb 28 17:26 micro-config-drive

[20051.439494] lib: Executing: /bin/bash -c "wget http://slashdot.org -O /tmp/index.html "
[20051.441239] lib: Command failed
[20051.441277] lib: STD Error: /bin/bash: wget: command not found

[20051.441288] lib: STD output: 
[20051.441299] runcmd: Execute command failed
[20051.441316] lib: Executing: /bin/bash -c "sh -c echo \"=========hello world'=========\" "
[20051.443245] lib: STD output: 

[20051.443287] lib: Executing: /bin/bash -c "sh -xc echo $(date) ': hello world!' "
[20051.446077] lib: STD output: 

[20051.446118] lib: Executing: /bin/bash -c "ls -l / "
[20051.448414] lib: STD output: total 64
drwxr-xr-x   1 root root 4096 Feb 26 13:34 bin
drwxr-xr-x   2 root root 4096 Apr 12  2016 boot
drwxr-xr-x   5 root root  360 Feb 28 14:48 dev
drwxr-xr-x   1 root root 4096 Feb 28 17:21 etc
drwxr-xr-x   2 root root 4096 Apr 12  2016 home
drwxr-xr-x   1 root root 4096 Feb 26 10:18 lib
drwxr-xr-x   2 root root 4096 Jan 23 22:49 lib64
drwxr-xr-x   2 root root 4096 Jan 23 22:49 media
drwxr-xr-x   2 root root 4096 Jan 23 22:49 mnt
drwxr-xr-x   2 root root 4096 Jan 23 22:49 opt
dr-xr-xr-x 180 root root    0 Feb 28 14:48 proc
drwx------   1 root root 4096 Feb 28 17:21 root
drwxr-xr-x   1 root root 4096 Feb 26 13:34 run
drwxr-xr-x   1 root root 4096 Feb 26 10:16 sbin
drwxr-xr-x   2 root root 4096 Jan 23 22:49 srv
dr-xr-xr-x  13 root root    0 Feb 28 17:16 sys
drwxrwxrwt   1 root root 4096 Feb 28 17:21 tmp
drwxr-xr-x   1 root root 4096 Jan 23 22:49 usr
drwxr-xr-x   1 root root 4096 Jan 23 22:49 var

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions