Pyhaystack is a module that allow python programs to connect to a haystack server project-haystack.org. Connection can be established with Niagara Platform running the nhaystack, Skyspark and Widesky. For this to work with Anaconda IPython Notebook in Windows, be sure to use "python setup.py install" using the Anaconda Command Prompt in Windows. If not, module will be installed for System path python but won't work in the environment of Anaconda IPython Notebook. You will need hszinc 1.3+ for this to work.
Apache License 2.0
74
stars
32
forks
source link
hszinc.zincparser.ZincParseException: Failed to parse: Expected end of text, found '"' (line:6, col:1) #112
After a new Skyspark upgrade, we are getting zincparser error trying to read this hszinc data
Expected end of text, found '"' (at char 1134), (line:6, col:1)
Expected end of text, found '"' (line:6, col:1)
Expected end of text, found '"' (at char 1134), (line:6, col:1)
Expected end of text, found '"' (line:6, col:1)
Expected end of text, found '"' (at char 1134), (line:6, col:1)
Expected end of text, found '"' (line:6, col:1)
Traceback (most recent call last):
File "C:\Users\renan_francisco\Documents\Projects\Facilities\automation\Python\Python\haystack_conn.py", line 136, in
print(eval("hostSettings(\"ldap\")"))
File "C:\Users\renan_francisco\Documents\Projects\Facilities\automation\Python\Python\haystack_conn.py", line 33, in eval
return op.result
File "C:\Users\renan_francisco\AppData\Roaming\Python\Python310\site-packages\pyhaystack\util\state.py", line 100, in result
self._result.reraise()
File "C:\Users\renan_francisco\AppData\Roaming\Python\Python310\site-packages\pyhaystack\util\asyncexc.py", line 29, in reraise
reraise(*self._exc_info)
File "C:\Users\renan_francisco\AppData\Roaming\Python\Python310\site-packages\six.py", line 719, in reraise
raise value
File "C:\Users\renan_francisco\AppData\Roaming\Python\Python310\site-packages\pyhaystack\client\ops\grid.py", line 320, in _on_response
decoded = hszinc.parse(body, mode=hszinc.MODE_ZINC, single=False)
File "C:\Users\renan_francisco\AppData\Roaming\Python\Python310\site-packages\hszinc\parser.py", line 78, in parse
grids = list(map(_parse, grid_data))
File "C:\Users\renan_francisco\AppData\Roaming\Python\Python310\site-packages\hszinc\parser.py", line 100, in parse_grid
return parse_zinc_grid(grid_str)
File "C:\Users\renan_francisco\AppData\Roaming\Python\Python310\site-packages\hszinc\zincparser.py", line 657, in parse_grid
raise ZincParseException(
hszinc.zincparser.ZincParseException: Failed to parse: Expected end of text, found '"' (line:6, col:1)
ver:"3.0"
name,defVal,kind,restart,placeholder,unitless,is,enum,multiLine,doc
"host",,"Str",,"ldap.acme.com",,,,,"LDAP server hostname or IP address\n"
"port",636,"Number",,"636",M,,,,"LDAP server port\n"
"tls",T,"Bool",,,,,,,"Use TLS/SSL when connecting to LDAP server\n\nMake sure the LDAP server certificate chain is trusted.\nRestart SkySpark after using Host | Crypto | Trust Uri.\n"
**"connectTimeout",1s,"Number",,,,[^duration],,,"LDAP connect timeout\n"
**"readTimeout",10s,"Number",,,,[^duration],,,"LDAP read timeout\n"****
"userBaseDN",,"Str",,"CN=SkySparkUsers,OU=Groups,DC=acme,DC=com",,,,,"Base DN to search for users\n"
"loginAttr","sAMAccountName","Str",,,,,,,"Attribute in LDAP server used to lookup the user to authenticate\n"
"loginUpdateMode","authOnly","Str",,,,,"authOnly, updateOnLogin",,"This setting determines how the user rec is managed in the local\nuser database when a user logs in.\n- 'authOnly': LDAP will only be used for authenticating the user. The user\n*must* exist in the user database in order to log in.\n- 'updateOnLogin': Creates or updates the user database rec every time the\nuser logs in by applying the configured prototype and invoking the 'applyTagsFunc'\n(if configured). The user rec is only updated if the prototype assignment changes,\nor tags are modified by the the 'applyTagsFunc'.\n"
"userAttrs","mail, displayName","Str",,,,,,,"Additional attributes to retrieve for a user. By default, we always get the\n'loginAttr' and 'userProtoAttr'.\n\nThe value is a comma-separated list of the LDAP attributes to retrieve. To\nretrieve all attributes, use the value '*' (note - this can be expensive).\n"
"userProtoAttr","memberOf","Str",,,,,,,"The attribute on the user's LDAP entry that is used to determine the user's prototype.\n"
"userProtoDefault",,"Str",,,,,,,"*Optional* - If a user cannot be mapped to a prototype via the 'userProtoAttr', then\nuse the prototype with this name as the default.\n"
"userProtoPriority","default","Str",,,,,,,"If the 'userProtoAttr' indicates the user matches multiple user prototypes,\nthen the user will be assigned the first prototype that it matches from this\nlist. The match is based on the userProtoName value of userProto recs.\n\nFurther, only users that map to one of these prototypes will be allowed to login.\nSo this list also serves as a user prototype whitelist.\n\nThe value is a comma-separated list of user prototype names.\n"
"applyTagsFunc",,"Str",,,,,,M,"*Optional*. You may define an Axon callback function that gives you an\nopportunity to set/change tags on a user before a session is created.\nThe function should take two parameters (user, attrs) where 'user'\nis the current User tags (with prototype already applied) and 'attrs'\nis the LDAP attributes Dict for that user. Return the updated User Dict.\n"
"serviceAccountDN",,"Str",,"CN=SkySpark Service,OU=Service Accounts,DC=acme,DC=com",,,,,"LDAP Service Account Bind DN\n\nImportant: Make sure the service account has rights to issue read\nqueries against the User Search Base DN.\n"
"password",,"Str",,,,,,,
I believe the error is here :
6 >"connectTimeout",1s,"Number",,,,[^duration],,,"LDAP connect timeout\n"
When trying to parse this [^duration]
On the other version it works, but hszinc data was different:
ver:"3.0"
name,defVal,kind,restart,placeholder,unitless,enum,multiLine,doc
"host",,"Str",,"ldap.acme.com",,,,"LDAP server hostname or IP address\n"
"port",636,"Number",,"636",M,,,"LDAP server port\n"
"tls",T,"Bool",,,,,,"Use TLS/SSL when connecting to LDAP server\n\nMake sure the LDAP server certificate chain is trusted.\nRestart SkySpark after using Host | Crypto | Trust Uri.\n"
"userBaseDN",,"Str",,"CN=SkySparkUsers,OU=Groups,DC=acme,DC=com",,,,"Base DN to search for users\n"
"loginAttr","sAMAccountName","Str",,,,,,"Attribute in LDAP server used to lookup the user to authenticate\n"
"loginUpdateMode","authOnly","Str",,,,"authOnly, updateOnLogin",,"This setting determines how the user rec is managed in the local\nuser database when a user logs in.\n- 'authOnly': LDAP will only be used for authenticating the user. The user\n*must* exist in the user database in order to log in.\n- 'updateOnLogin': Creates or updates the user database rec every time the\nuser logs in by applying the configured prototype and invoking the 'applyTagsFunc'\n(if configured). The user rec is only updated if the prototype assignment changes,\nor tags are modified by the the 'applyTagsFunc'.\n"
"userAttrs","mail, displayName","Str",,,,,,"Additional attributes to retrieve for a user. By default, we always get the\n'loginAttr' and 'userProtoAttr'.\n\nThe value is a comma-separated list of the LDAP attributes to retrieve. To\nretrieve all attributes, use the value '*' (note - this can be expensive).\n"
"userProtoAttr","memberOf","Str",,,,,,"The attribute on the user's LDAP entry that is used to determine the user's prototype.\n"
"userProtoDefault",,"Str",,,,,,"*Optional* - If a user cannot be mapped to a prototype via the 'userProtoAttr', then\nuse the prototype with this name as the default.\n"
"userProtoPriority","default","Str",,,,,,"If the 'userProtoAttr' indicates the user matches multiple user prototypes,\nthen the user will be assigned the first prototype that it matches from this\nlist. The match is based on the userProtoName value of userProto recs.\n\nFurther, only users that map to one of these prototypes will be allowed to login.\nSo this list also serves as a user prototype whitelist.\n\nThe value is a comma-separated list of user prototype names.\n"
"applyTagsFunc",,"Str",,,,,M,"*Optional*. You may define an Axon callback function that gives you an\nopportunity to set/change tags on a user before a session is created.\nThe function should take two parameters (user, attrs) where 'user'\nis the current User tags (with prototype already applied) and 'attrs'\nis the LDAP attributes Dict for that user. Return the updated User Dict.\n"
"serviceAccountDN",,"Str",,"CN=SkySpark Service,OU=Service Accounts,DC=acme,DC=com",,,,"LDAP Service Account Bind DN\n\nImportant: Make sure the service account has rights to issue read\nqueries against the User Search Base DN.\n"
"connectTimeout",1s,"Number",,,,,,"LDAP connect timeout\n"
"readTimeout",10s,"Number",,,,,,"LDAP read timeout\n"
"password",,"Str",,,,,,
I got a help from Application support that uses Skyspark. As workaround, We changed to hostSettings(\"ldap\").removeCol(\"is\"). Looks like PyHaystack is not handling symbol correctly
After a new Skyspark upgrade, we are getting zincparser error trying to read this hszinc data
I believe the error is here : 6 >"connectTimeout",1s,"Number",,,,[^duration],,,"LDAP connect timeout\n"
When trying to parse this [^duration]
On the other version it works, but hszinc data was different:
My code