Esri / arcgis-cookbook

Chef cookbooks for ArcGIS
Apache License 2.0
300 stars 116 forks source link

NoMethodError while registering SDE files in ArcGIS Server 10.7.1 #244

Closed jesa-esrich closed 3 years ago

jesa-esrich commented 4 years ago

Environment: Windows Server 2016 ArcGIS Server 10.7.1 Chef Client 14.14.29 Microsoft SQL Server 2017 Microsoft SQL Server Driver 17 ArcGIS Cookbook 3.4.0

While installing and configuring ArcGIS Server 10.7.1 with Chef the script runs into an error while registering SDE Files in ArcGIS Server (registering folders works):

This worked perfectly fine for the ArcGIS Cookbook 3.3.1 and ArcGIS Server 10.6.1. The mentioned recipe and depending files (providers...etc.) also haven't changed between those version.

Does anyone know the cause for this error and how to resolve it?

cameronkroeker commented 4 years ago

@jesa-esrich

Have you also tried with the latest cookbook release v3.5.0?

https://github.com/Esri/arcgis-cookbook/releases/tag/v3.5.0

jesa-esrich commented 4 years ago

@cameronkroeker I will give it a try. However, the specified recipe "datasources" hasn't changed for 2 years. So I'm not quite sure what is causing the problem. We will also try to register other sde files.

jesa-esrich commented 4 years ago

The problem persist with the newest cookbook release. And registering another SDE connection file also didn't help.

cameronkroeker commented 4 years ago

@jesa-esrich Would you be able to share your role json file? (Please scrub out any sensitive information such as passwords, hostnames, etc).

jesa-esrich commented 4 years ago

@cameronkroeker

Here's the role json. As a side note there are also some custom recipes (marked as custom in the run list):

{ "arcgis": { "run_as_user": "domain\user", "run_as_password": "PASSWORD", "version": "10.7.1", "repository": { "archives": "\\machinenameShare\hbd\dev\@Software\ESRI\ArcGIS Enterprise 10.7.1", "setups": "E:\AutomatedDeployment\ArcGIS", "patches": "E:\AutomatedDeployment\ArcGIS\Patches" }, "iis": { "keystore_file": "C:\chef\keystore\Certificate.pfx", "keystore_password": "PASSWORD" }, "web_adaptor": { "admin_access": true }, "server": { "admin_username": "agsadmin", "admin_password": "PASSWORD", "install_system_requirements": false, "security": { "user_store_config": { "type": "ASP_NET", "class": "AGSMembershipProvider.AGSADMembershipProvider", "properties": { "adminUser": "domain\user", "adminUserPassword": "PASSWORD" } }, "role_store_config": { "type": "ASP_NET", "class": "AGSMembershipProvider.AGSADRoleProvider", "properties": { "adminUser": "domain\user", "adminUserPassword": "PASSWORD" } }, "privileges": { "PUBLISH": ["domain\user2"], "ADMINISTER": ["domain\user"] } }, "wa_name": "arcgis", "install_dir": "E:\Programs\ArcGIS\Server", "local_directories_root": "E:\arcgisserver", "authorization_file": "E:\AutomatedDeployment\ArcGIS\Authorization_Files\Server.ecp", "keystore_file": "C:\chef\keystore\Certificate.pfx", "keystore_password": "PASSWORD", "soc_max_heap_size":256 }, "python": { "install_dir": "E:\Programs\Python" }, "datasources": { "block_data_copy": true, "folders": [ { "server_path": "E:\Mapfiles", "create_folder": true, "security_permissions": { "authorize_arcgis_service_account": true, "full_control_members": ["domain\user2"] }, "share_folder": true, "share_name": "Mapfiles", "sharing_permissions": { "full_control_members": ["domain\user2", "domain\user"] }, "publish_folder": { "identifier": "Mapfiles", "publish_with_hostname": true } },{ "server_path": "E:\Data", "create_folder": true, "security_permissions": { "authorize_arcgis_service_account": true, "full_control_members": ["domain\user2", "domain\user"] }, "share_folder": true, "share_name": "Data", "sharing_permissions": { "full_control_members": ["domain\user2", "domain\user"] }, "publish_folder": { "identifier": "Data", "publish_with_hostname": true } },{ "server_path": "E:\Data", "publish_folder": { "identifier": "Data_With_Alias", "publish_alternative_path": "\\machinename\Data" } },{ "server_path": "E:\Mapfiles", "publish_folder": { "identifier": "Mapfiles_With_Alias", "publish_alternative_path": "\\machinename\Mapfiles" } },{ "publish_folder": { "identifier": "Rasterdaten", "publish_alternative_path": "\\machinenameShare\geo\gdi\rasterdaten" } } ], "sde_files": { "folder": "\\machinenameShare\documentation_installation\arcgis_db_connectionfiles\ChangeFolder" } }, "backups": { "site_backup_dir": "\\machinenameShare\Backups\ChangeFolder\ArcGISServerSite" }, "misc": { "script_directory": "E:\AutomatedDeployment\Scripts" } }, "run_list": [ "recipe[arcgis-enterprise::system]", "recipe[esri-iis]", "recipe[arcgis-enterprise::server]", "recipe[custom-arcgis-enterprise::sql_server_client]", "recipe[arcgis-enterprise::server_security]", "recipe[arcgis-enterprise::server_wa]", "recipe[arcgis-enterprise::datasources]", "recipe[custom-arcgis-enterprise::backups]", "recipe[arcgis-enterprise::patches]", "recipe[custom-arcgis-enterprise::pagefile]" ] }

jesa-esrich commented 4 years ago

@cameronkroeker We tested a couple of other things:

cameronkroeker commented 4 years ago

@jesa-esrich

Thank you for providing the role json file used. I suspect the error undefined method each for nil:NilClass is because the ['node']['arcgis']['datasources']['sde_files']['files'] attribute is missing from the role json file.

I was able to reproduce the same error. Try adding the following to the json file:

"sde_files": {
"folder": \\machinenameShare\documentation_installation\arcgis_db_connectionfiles\ChangeFolder,
“files”:[]
}

This workaround worked for me.

And to your point about: "CHEF seems to use the CN for accessing the server website and registering the datasources (registering folders at least)."

I suspect this is because of the following:

https://github.com/Esri/arcgis-cookbook/blob/50cbc0f53382dd7f44311018e02d64e09624174b/cookbooks/arcgis-enterprise/providers/datasources.rb#L204

Looks like if ['arcgis']['datasources']['server_config_url'] is not specified then it will construct the following url:

  `server_url = 'https://' + cert_cn + ":6443/arcgis/admin"`

So perhaps try defining ['arcgis']['datasources']['server_config_url'] attribute in the role json file as well.

jesa-esrich commented 4 years ago

@cameronkroeker Thanks a lot for the workaround! Worked like a charm. As a side note: this also has to be done if the sde file connection files are registered using the files parameter. Hence in this case the folder parameter has to be passed as empty value "folder": ""

--> would be great to adjust/mention this in the documentation. Quite weirdly this was not needed for ArcGIS Cookbook 3.3.1 and ArcGIS Server 10.6.1. Maybe there was some dependency with the chef client.

Concerning the suggestion for the certificate, the server url parameter did not resolve it. It still uses the CN for accessing the server and registering the datasources. But I only ran the scripts isolated using the datasources recipe. I'll keep you up to date if something changes if I run the whole list of recipes. The workaround would be to use the FQDN as CN in the certificate.

cameronkroeker commented 4 years ago

@jesa-esrich

Glad to hear that the workaround resolved the issue.

--> would be great to adjust/mention this in the documentation. Quite weirdly this was not needed for ArcGIS Cookbook 3.3.1 and ArcGIS Server 10.6.1. Maybe there was some dependency with the chef client.

This very well could be the case as there hasn't been any changes made to the datasources recipe in quite some time. I've made an internal issue for us to adjust the logic as this isn't the desired behavior with the "folders":"" and "files":"" attributes. We are also going to evaluate the server_config_url logic as well as this looks like it can be improved upon.

Thanks for bringing this to our attention and apologies that it took so long to find a workaround.

cameronkroeker commented 3 years ago

This has been fixed in cookbook release v3.6.1:

https://github.com/Esri/arcgis-cookbook/releases