Create User Attribute

I would like to add a UMASK=“117” attribute to each user as they are being created. Is there a default USER TEMPLATE that can be modified to automatically include this attribute as the user is created?

Thanks

Bob opennebula@discoursemail.com writes:

I would like to add a UMASK=“117” attribute to each user as they are being created. Is there a default USER TEMPLATE that can be modified to automatically include this attribute as the user is created?

I think one option is to use a hook:

http://docs.opennebula.org/5.4/integration/infrastructure_integration/hooks.html#other-hooks

Regards.

I did not stop to think about using hooks. I believe a VM hook will actually do what I am ultimately want to achieve which is set the Use & Manage flags for Groups when members of a specific group instantiate a new VM.

Configuring the VM_HOOK stanza in oned.conf is pretty straight forward. But I have been unable to find a good sample script online that sets permission flags for users in a specific group.

Any recommendations to where I could look?

Thanks

Hi @DaD @amarti
Is there hook for user as hook-vm.
I want to do some action on oneuser create.
Please help on the same.

Hello @Rahul_Sharma,

You can use API hook on call one.user.allocate, check this.

Best,
Álex.

Thanks @ahuertas !!

As suggested I have used API hook added below lines in oned.config
USER_HOOK = [
NAME = hook-API
TYPE = api
COMMAND = “log_new_user.rb”
ARGUMENTS = $API
CALL = “one.user.allocate”
ARGUMENTS_STDIN = yes]

I am getting the error message on allocating user from Sunstone/API:
Internal error No such file or directory - /var/lib/one/remotes/hooks/log_new_user.rb
Even though I am having file at the defined location.
Please guide me where I am going in wrong direction.

Hello @perrfect ,
Could you please suggest on the above issue, if you have encountered or worked successfully on Hook?

Thanks in advance!!

Hello @Rahul_Sharma,

Please check that the file have the right permissions and that it can be executed by oneadmin user.

Best,
Álex.

Thanks @ahuertas !
The issue got resolved by right permissions to the file.

1 Like

Hello @ahuertas
I am trying to create template with User inputs using CLI but it is not accepting --user-inputs. Template is created without user inputs.

Could you please verify or correct the below onetemplate CLI command:
onetemplate create --name “VMTemplate” --cpu 0.1 --user-inputs name=“userinput”

Thanks in advance!!

Hello @Rahul_Sharma,

Please take in account that --user-inputs is used when instantiating a template, not when creating it.

Best,
Álex.

Thanks @ahuertas !!

1 Like