Subscribe

WFA: Changing UID:GID input to string instead of integer

Hello,

 

I am trying to modify my workflow that creates a UNIX volume and specify the UID:GID


When creating a volume, I notice that the default type for setting UID and GID is an integer.  

Does anybody know why this is defaulted as integer and how we can change this to string. 

 

 Capture.PNG

Re: WFA: Changing UID:GID input to string instead of integer

Hi,

ONTAP expects the user and group identification information of a new volume as an integer value. The default value is 0 ('root'), and this representation is similar to how an user and group id is represented on UNIX system.

You can change the $userid parameter type from Number to String in Workflow UserInputs or if your input parameter is really a string and is specified in UID:GID format, then you can use some function to split the IDs and can return an integer value of it. As an example, you can refer the certified 'splitByDelimiter' function.

Re: WFA: Changing UID:GID input to string instead of integer

Thanks for the reply.

 

I understand your point, however in real world use cases this makes it rather difficult to give the appropriate group ownership

In my case I am using 2 seperate fields when creating a volume to enter a UID and a GID.  To make things easier, I am not going to use UID:GID format and split them.

 

The userinputs are set to string however it still shows as integer when editing/filling the workflow.

 

The only place I can think of changing that is in the Dictionary, however I think that would cause more issues

 

 

Re: WFA: Changing UID:GID input to string instead of integer

OK, I think you want to provide name instead of integer value for a volume user or group ID,  and netither WFA nor OCUM cache this name/id information from ONTAP.

I don't think changing dictionary entry / command would solve this problem.

 

To workaround this, we should first get the existing user name to id mapping information from ONTAP using 'unix-user show -vserver' CLI command, and then provide that mapping information in the workflow user input query for $userid parameter.  

 

e.g.: In your workflow, change the $userid parameter type from String to Query and provide the name to ID mapping information in the query like shown below.  This way you will always know the name and id for the user/group while creating the volume.

 

SELECT

    "0" AS "User_id",

    "root" AS "User_name"

Union

SELECT

    "65535" AS "User_id",

    "nobody" AS "User_name"

union

SELECT

    "65534" AS "User_id",

    "pcuser" AS "User_name"

 

Re: WFA: Changing UID:GID input to string instead of integer

I appreciate your response, unfortunately this wont work.

 

We dont keep local UNIX accounts on the cluster as we are using a different solution.

 

I was thinking of keeping the GID -> Unix Group  database somewhere and query that when needed.

 

I will try it out and report back