Start a Conversation

Unsolved

This post is more than 5 years old

WB

750

May 24th, 2017 08:00

API Returns 'None' for Description from list_smb_shares

I have used one of the examples to get the detail of our SMB shares, as I need to clone them to our DR cluster.

Mostly it works as expected, this is a fragment:

api_response = protocols_api.list_smb_shares(sort=sort, limit=limit, dir=sdir, scope=scope)

pprint(api_response)

I have scope set to "user" so that it should return only the non-default values.  In fact it returns all values with the defaults set to None; that is fine but the Description is returned as None when it is not blank at all:

{'resume': '1-1-MAAA1-MAAA1-MgAA1-MAAA0-1-MQAA4-NTA3MAAA4-NTA3MAAA',

'shares': [{'access_based_enumeration': None,

             'access_based_enumeration_root_only': None,

             'allow_delete_readonly': None,

             'allow_execute_always': None,

             'allow_variable_expansion': None,

             'auto_create_directory': None,

             'browsable': True,

             'change_notify': None,

             'create_permissions': None,

             'csc_policy': None,

             'description': None,

             'directory_create_mask': None,

If I use the CLI to list this in JSON format I can see the Description is not blank:

rothstore1-2# isi smb shares list --limit 1 --format json

[{"file_create_mode": 64, "ntfs_acl_support": true, "directory_create_mask": 448, "access_based_enumeration_root_only": false, "file_create_mask": 448, "path": "/ifs/roth/projects/2020wheatm", "inheritable_path_acl": false, "allow_variable_expansion": false, "id": "2020wheatm", "hide_dot_files": false, "create_permissions": "default acl", "strict_locking": false, "mangle_map": ["0x01-0x1F:-1", "0x22:-1", "0x2A:-1", "0x3A:-1", "0x3C:-1", "0x3E:-1", "0x3F:-1", "0x5C:-1"], "zid": 1, "run_as_root": [], "browsable": true, "description": "John Doe\n",

If I set the scope to "effective" I do get the Description back from the API:

'description': 'John Doe\n',

And lastly if I set the scope to "default" I get from the API:

'description': 'Isilon OneFS',

It does not seem to work as expected.  The point of the "user" scope is that I don't need to do anything about values that return "None" as they have not been customised.  I'm wondering if the \n is causing a problem under the hood.  When I was testing json.loads and giving it a static string (pasted from the CLI output) it objected to the \n.  However that wouldn't explain the behaviour of scope "effective".

I'm thinking a bug in the code determining that the Description is a string but the string isn't 'Isilon OneFS'.

31 Posts

May 24th, 2017 10:00

It would also be worth logging an issue on the SDK github site https://github.com/Isilon/isilon_sdk/issues

Thanks,

Chris

1.2K Posts

May 24th, 2017 10:00

Yeah, looks like an issue in the SDK rather than OneFS.

Consider posting in the #isilon channel at codecommunity.slack.com

-- Peter

May 26th, 2017 02:00

Actually I am more inclined to think that it is in OneFS than the SDK.  I have run the same query through the PAPI using curl:

#!/bin/bash

cluster="https://rothclus1:8080"

#+

# Get a session cookie

#-

curl -k --header "Content-Type: application/json" \

-c cookiefile -X POST -d @.ssh/auth.json ${cluster}/session/1/session

#+

# Check the connection

# -

curl -k  -b @cookiefile  ${cluster}/session/1/session?isisessid

#+

# Get SMB shares

#-

limit=2

dir="ASC"

scope="user"

query=$(printf "%s" "${cluster}/platform/1/protocols/smb/shares?dir=${dir}&scope=${scope}&limit=${limit}")

curl -k  -b @cookiefile ${query}

#+

# Close the session

#-

#curl -k  -b @cookiefile -X DELETE ${cluster}/session/1/session

I get the answer without the Description field, even though that field is set to the name of the share owner.

$ ./isi_connect.sh

{"services":["platform","namespace"],"timeout_absolute":14400,"timeout_inactive":900,"username":"XXXX"}

{"services":["platform","namespace"],"timeout_absolute":14400,"timeout_inactive":900,"username":"XXXX"}

{

"resume" : "1-1-MAAA1-MAAA1-MgAA1-MAAA0-1-MQAA4-NTA3MAAA4-NTA3MAAA",

"shares" :

[

{

"browsable" : true,

"id" : "2020wheatm",

"name" : "2020wheatm",

"path" : "/ifs/roth/projects/2020wheatm",

"permissions" :

[

...permissions follow...

],

"zid" : 1

}

],

"total" : 549

}

Using curl isn't using the SDK, it is sending that query to the Isilon, so it must be at that end that the Description is being dropped.  It is tedious as it means that I will either have to do two queries, one to find the fields that are customised and another to find the Description, or do one query with scope set to "default", capture the default value for every field, and then do the query with scope set to "effective" and filter out myself any returned values that are in fact the defaults.  All in all a PITA.

1.2K Posts

May 30th, 2017 12:00

Good catch! 

FWIW, a quick test with a 8.1.0.0 (sic!) virtual node looked ok:

scope=default: a single set of share parameters is shown, the defaults

scope=effective: for each actual share, the effect params are shown

scope=user: for each actual share, just the non-default params are shown, including the 'description'

'None' is never used: params not set are simply omitted.

Now the price question is: did it get fixed in some in 8.0.0.* or 8.0.1.* release...

-- Peter

1.2K Posts

May 31st, 2017 02:00

Quick update: I have tested OneFS 8.0.0.2, same good behavior as above with 8.1.0.0

-- Peter

No Events found!

Top