Esri / arcgis-cookbook

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

Error executing action `authorize` on resource 'arcgis_enterprise_portal[Authorize Portal for ArcGIS]' #295

Open mayorvlf opened 3 years ago

mayorvlf commented 3 years ago
================================================================================
Error executing action `authorize` on resource 'arcgis_enterprise_portal[Authorize Portal for ArcGIS]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '127'
---- Begin output of "/arcgis/portal/tools/authorizeSoftware" -f "/opt/software/authorization_files/10.9/ArcGIS_Enterprise_Portal_109_366387_20211123.json" ----
STDOUT:
STDERR: sh: 1: /arcgis/portal/tools/authorizeSoftware: not found
---- End output of "/arcgis/portal/tools/authorizeSoftware" -f "/opt/software/authorization_files/10.9/ArcGIS_Enterprise_Portal_109_366387_20211123.json" ----
Ran "/arcgis/portal/tools/authorizeSoftware" -f "/opt/software/authorization_files/10.9/ArcGIS_Enterprise_Portal_109_366387_20211123.json" returned 127

Cookbook Trace:
---------------
/root/.cinc/local-mode-cache/cache/cookbooks/arcgis-enterprise/providers/portal.rb:292:in `block in class_from_file'

Resource Declaration:
---------------------
# In /root/.cinc/local-mode-cache/cache/cookbooks/arcgis-enterprise/recipes/portal.rb

 54: arcgis_enterprise_portal 'Authorize Portal for ArcGIS' do
 55:   authorization_file node['arcgis']['por

cinc-stacktrace.out.txt tal']['authorization_file'] 56: authorization_file_version node['arcgis']['portal']['authorization_file_version'] 57: user_license_type_id node['arcgis']['portal']['user_license_type_id'] 58: portal_url node['arcgis']['portal']['url'] 59: username node['arcgis']['portal']['admin_username'] 60: password node['arcgis']['portal']['admin_password'] 61: action :authorize 62: end 63:

Compiled Resource:
------------------
# Declared in /root/.cinc/local-mode-cache/cache/cookbooks/arcgis-enterprise/recipes/portal.rb:54:in `from_file'

arcgis_enterprise_portal("Authorize Portal for ArcGIS") do
  action [:authorize]
  default_guard_interpreter :default
  declared_type :arcgis_enterprise_portal
  cookbook_name "arcgis-enterprise"
  recipe_name "portal"
  authorization_file "/opt/software/authorization_files/10.9/ArcGIS_Enterprise_Portal.json"
  authorization_file_version "10.9"
  user_license_type_id "creatorUT"
  portal_url "https://esr.domain.com:7443/arcgis"
  username "xxxxxxx"
  password "xxxxxxxx"
end

System Info:
------------
chef_version=15.17.4
platform=ubuntu
platform_version=20.04
ruby=ruby 2.6.7p197 (2021-04-05 revision 67941) [x86_64-linux]
program_name=/usr/bin/cinc-client
executable=/opt/cinc/bin/cinc-client
cameronkroeker commented 3 years ago

Hi @mayorvlf,

Could you try the following request in a web browser (on the portal node) to see what is returned?

https://esr.domain.com:7443/arcgis/portaladmin/?f=pjson

We should see a response similar to:

{
    "status": "error",
    "messages": ["The portal site has not been initialized. Please create a new site and try again."],
    "resources": ["license"],
    "isPortalLicensed": false,
    "isLicenseFileRequired": true,
    "isUserTypeLicensing": true,
    "version": "10.9"
}

Thanks, Cameron K.

mayorvlf commented 3 years ago

Hi @cameronkroeker I followed your instructions and this is what I get in return from the browser: { "error" : { "code" : 499, "message" : "Token Required.", "details" : null } }

cameronkroeker commented 3 years ago

Hi @cameronkroeker I followed your instructions and this is what I get in return from the browser: { "error" : { "code" : 499, "message" : "Token Required.", "details" : null } }

Hi @mayorvlf,

This means the portal site already exists which means you'll either need to pass in a token, or login with a portal administrator account then submit the request.

Was the portal site previously created manually or on a different chef run?

Thanks, Cameron K.

mayorvlf commented 3 years ago

Hi Cameron, I was using a different chef run but as errors were coming up had to re-run the recipe after fixing the issue.

cameronkroeker commented 3 years ago

Hi Cameron, I was using a different chef run but as errors were coming up had to re-run the recipe after fixing the issue.

Hi @mayorvlf,

May I ask what steps were taken to resolve the issue?

Thanks, Cameron K.

mayorvlf commented 3 years ago

Hi Cameron, I was able to fix some other issue related to directory location and run the recipe again to continue installation then I ran into this current issue that have not been able to fix for what I understand it is looking for this directory to run the authorization file /arcgis/portal/tools/authorizeSoftware but the authorizeSoftware is missing in that directory.

cameronkroeker commented 3 years ago

Hi Cameron, I was able to fix some other issue related to directory location and run the recipe again to continue installation then I ran into this current issue that have not been able to fix for what I understand it is looking for this directory to run the authorization file /arcgis/portal/tools/authorizeSoftware but the authorizeSoftware is missing in that directory.

Portal for ArcGIS 10.9 uses user type licenses, which means the authorization file (*.json) is passed through the portal site, and not the Authorization tool. In the cookbooks we do a check to see if its user type licensing or if the authorization needs to be handled by the tool:

https://github.com/Esri/arcgis-cookbook/blob/f973da68d5d092ebedc005bc9b79611e5aa5aaba/cookbooks/arcgis-enterprise/providers/portal.rb#L244-L256

If "isUserTypeLicensing": true, is returned then the authorization file will be sent to the Create Site action (I believe this started in 10.7+):

https://github.com/Esri/arcgis-cookbook/blob/f973da68d5d092ebedc005bc9b79611e5aa5aaba/cookbooks/arcgis-enterprise/recipes/portal.rb#L64-L68

But if "isUserTypeLicensing": false, is returned then that means the portal authorization file (.prvc or .ecp) needs to be authorized using the tool (10.6.1 and below):

https://github.com/Esri/arcgis-cookbook/blob/f973da68d5d092ebedc005bc9b79611e5aa5aaba/cookbooks/arcgis-enterprise/providers/portal.rb#L275-L277

This is why I was curious to see what was being returned. For some reason in your case its going into the else statement and trying to authorize the portal license (*.json) via the tool when it should actually be passed into the create site action.

Thanks, Cameron K.

cameronkroeker commented 3 years ago

Hello @mayorvlf,

I wanted to follow up to see if there has been any progress made on this issue? Also, there is a new release of the cookbooks v3.8.0 that may be worth trying as well.

Thanks, Cameron K.

cameronkroeker commented 3 years ago

Similar issue: https://github.com/Esri/arcgis-cookbook/issues/257