New Question
0

Metadata doesnt override username

asked 2021-11-11 14:47:06 +0200

cans0ylu gravatar image

updated 2021-11-12 12:59:01 +0200

Hello everyone,

I've patched my proxmox to create a metadata file that can be read by cloudbase-init. It works fine for the hostname, uuid, password etc.

But cloudbase never overrides the conf username by username given by metadata.

The variable i generate is "adminusername", i've checked in the getadmin_username definition on the python modules in the cloudbase and it is the variable it looks for. (i even tried just username, it didnt work).

Cloudbase at boot always uses the conf.username and when i delete username from the conf file it uses default username which is Admin.

This is the part of the creatuser module where it gets the username;

def execute(self, service, shared_data):
    user_name = service.get_admin_username() or CONF.username
    shared_data[constants.SHARED_DATA_USERNAME] = user_name

the called service.getadminusername() is ;

def get_admin_username(self):
    return self._get_meta_data().get('meta', {}).get('admin_username')
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2021-11-13 14:18:24 +0200

cans0ylu gravatar image

Well, i found the answer. This was because this def gets the admin username from a dictionary called meta in the file. Since other definitions did it with both ways(inside meta dict or directly from the file), it was working for them but not this.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-11-11 14:47:06 +0200

Seen: 171 times

Last updated: Nov 13 '21