feilong icon indicating copy to clipboard operation
feilong copied to clipboard

"admin_password" parameter in config disk's meta_data.json is ignored

Open Bischoff opened this issue 1 year ago • 2 comments

I would like to set up root's password at deployment time.

Looking at the code of nova zvm connector, they pass it via admin_pass in the metadata file of the config disk. So I tried to do the same:

 {
   "uuid": "NAME",
+  "admin_pass": "ADMIN_PASS",
   "public_keys": {
     "Public Key": "PUBLIC_KEY"
   },
(...)

I'd like to contribute a fix to this problem, but there's something I do not understand. When I call the "Deploy Guest" API call, it uploads the "transport file" and then sends it to the VM's punch. Then it's used by cloud-init inside the Linux guest. But I could not find the code that manages this option.

Bischoff avatar May 16 '24 17:05 Bischoff

@SeanHQF do you know the details in this area?

bjhuangr avatar May 17 '24 01:05 bjhuangr

It's a known issue:

https://github.com/canonical/cloud-init/issues/2402

There are hacks out there to work around it:

http://madorn.com/cloud-init-admin-pass.html

So it was never going to work.

Actions

  1. If you'd like me to remove this (unrelated) dead code, just ask me:
    def get_change_passwd_command(self, admin_password):
        """construct change password command

        :admin_password: the password to be changed to
        """
        return "echo 'root:%s' | chpasswd" % admin_password

(in zvmsdk/dist.py), plus the testing code in zvmsdk/tests/fvt/test_guest.py:

            f.write('{"admin_pass": "sMcTNh8b65dM",\
  1. Also, feel free to remove that option from the zvm nova driver.

  2. Feel free to close this issue.

Bischoff avatar May 17 '24 12:05 Bischoff