Esri / arcgis-cookbook

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

Server authorization failing #227

Closed wilhelmi closed 5 years ago

wilhelmi commented 5 years ago

Installation is failing at the authorization step in a kitchen run. After the converge fails I can RDP into the VM and run the authorization gui with the same prvc file and it authorizes correctly. What am I missing here?

       Recipe: arcgis-enterprise::server
         * arcgis_enterprise_server[Authorize ArcGIS Server] action authorize

           ================================================================================
           Error executing action `authorize` on resource 'arcgis_enterprise_server[Authorize ArcGIS Server]'
           ================================================================================

           TypeError
           ---------
           no implicit conversion of nil into String

           Resource Declaration:
           ---------------------
           # In C:/Users/kitchen/AppData/Local/Temp/kitchen/cache/cookbooks/arcgis-enterprise/recipes/server.rb

            22: arcgis_enterprise_server 'Authorize ArcGIS Server' do
            23:   authorization_file node['arcgis']['server']['authorization_file']
            24:   authorization_file_version node['arcgis']['server']['authorization_file_version']
            25:   retries 2
            26:   retry_delay 30
            27:   notifies :stop, 'arcgis_enterprise_server[Stop ArcGIS Server]', :immediately
            28:   not_if { ::File.exists?(node['arcgis']['server']['cached_authorization_file']) &&
            29:            FileUtils.compare_file(node['arcgis']['server']['authorization_file'],
            30:                                   node['arcgis']['server']['cached_authorization_file']) }
            31:   action :authorize
            32: end
            33: 

           Compiled Resource:
           ------------------
           # Declared in C:/Users/kitchen/AppData/Local/Temp/kitchen/cache/cookbooks/arcgis-enterprise/recipes/server.rb:22:in `from_file'

           arcgis_enterprise_server("Authorize ArcGIS Server") do
             action [:authorize]
             default_guard_interpreter :default
             declared_type :arcgis_enterprise_server
             cookbook_name "arcgis-enterprise"
             recipe_name "server"
             authorization_file "C:\\Users\\kitchen\\AppData\\Local\\Temp\\kitchen\\data\\arcgis_license.prvc"
             authorization_file_version "10.7"
             retries 2
             retry_delay 30
             not_if { #code block }
           end

           System Info:
           ------------
           chef_version=14.13.11
           platform=windows
           platform_version=10.0.14393
           ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]
           program_name=C:/opscode/chef/bin/chef-client
           executable=C:/opscode/chef/bin/chef-client
cameronkroeker commented 5 years ago

Hello @wilhelmi,

The error 'no implicit conversion of nil into String' generally implies that something isn't getting defined that is required.

One possibility of this, is there is perhaps a missing cookbook dependency.

I recommend downloading and unzipping the full arcgis-cookbook from here.

After that I would try downgrading the Chef-Client from 14.13.11 to something like 13.6.0.

Does the error still occur?

wilhelmi commented 5 years ago

I will that a try. Here is the attribute configuration I have at the moment:

default['arcgis']['version'] = '10.7'
default['arcgis']['server']['install_system_requirements'] = true
default['arcgis']['repository']['archives'] = 'C:\temp\esri\setup'
default['arcgis']['repository']['setups'] = 'C:\temp\esri\setup'
default['arcgis']['server']['setup_archive'] = 'C:\temp\esri\ArcGIS_Server_Windows_107_167621.exe'
default['arcgis']['server']['setup'] = 'C:\temp\esri\setup\ArcGIS 10.7\ArcGISServer\Setup.exe'
default['arcgis']['server']['authorization_file'] = 'C:\Users\kitchen\AppData\Local\Temp\kitchen\data\arcgis_license.prvc'
pbobov commented 5 years ago

The error stack should be in \chef\node-cache\chef-stacktrace.out file. The error stack might provide a clue on the missing attribute.

Nickolaitc commented 5 years ago

Hey @wilhelmi,

Could you provide us the roles JSON you are trying to utilize?

wilhelmi commented 5 years ago

Here is what I am running for the role (arcgis-enterprise-windows.json):

{
  "arcgis": {
    "run_as_user": "arcgis",
    "run_as_password": "p@Pa$$w0rdPa$$w0rd",
    "version": "10.7",
    "server": {
      "admin_username": "admin",
      "admin_password": "changeit",
      "install_system_requirements": "true",
      "authorization_file": "C:\\Users\\kitchen\\AppData\\Local\\Temp\\kitchen\\data\\arcgis_license.prvc",
      "keystore_file": "C:\\keystore\\mydomain_com.pfx",
      "keystore_password": "changeit"
    }
  },
  "run_list": [
    "recipe[arcgis-enterprise::system]",
    "recipe[arcgis-enterprise::server]"
  ]
}

Kitchen suite is:

suites:
  - name: default
    run_list:
      - recipe[arcgis-gce::default]
      - role[arcgis-enterprise-windows]
    attributes:

The problem appears to be: node['arcgis']['server']['cached_authorization_file'] I put some logging in and it is empty..

As a further test if I comment out the not_if guard in arcgis_enterprise_server 'Authorize ArcGIS Server' the authorization times out. Looks like a missing auth file:

ProcessId: 3844
           app_name: C:\Program Files\Common Files\ArcGIS\bin\SoftwareAuthorization.exe
           command_line: "C:\Program Files\Common Files\ArcGIS\bin\SoftwareAuthorization.exe" /VER 10.7 /LIF "" /S
           timeout: 600
Nickolaitc commented 5 years ago

Hey @wilhelmi Thank you for sending this along, will be digging a bit on this. Which cookbook version are we utilizing?

wilhelmi commented 5 years ago

Running release 3.3.1 of the esri cookbook from a wrapper cookbook.

Got the issue sorted out. Needed to update the role json format. The following works:

{
  "name": "server-role",
  "description": "",
  "json_class": "Chef::Role",
  "default_attributes": {

  },
  "override_attributes": {
    "arcgis": {
      "run_as_user": "arcgis",
      "run_as_password": "p@Pa$$w0rdPa$$w0rd",
      "version": "10.7",
      "server": {
        "admin_username": "admin",
        "admin_password": "changeit",
        "install_system_requirements": "true",
        "authorization_file": "C:\\Users\\kitchen\\AppData\\Local\\Temp\\kitchen\\data\\arcgis_license.prvc",
        "keystore_file": "",
        "keystore_password": "changeit"
      }
    }
  },
  "chef_type": "role",
  "run_list": [
    "recipe[arcgis-enterprise::system]",
    "recipe[arcgis-enterprise::server]"
  ]
}
Nickolaitc commented 5 years ago

Hey @wilhelmi Interesting find, thank you for the information.