Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Services are not published into folders as expected #157

Closed
PleaseStopAsking opened this issue May 1, 2019 · 5 comments
Closed

Services are not published into folders as expected #157

PleaseStopAsking opened this issue May 1, 2019 · 5 comments

Comments

@PleaseStopAsking
Copy link
Contributor

When publishing services with the ArcGIS_Server_Service resource, it does not respect the folder key and instead publishes the services directly into the Site (root) folder. Along with not publishing the services into their respective folders, it throws an error.

ArcGIS_Server_Service bar {
  ServerHostName = $env:COMPUTERNAME
  PathToSourceFile = 'C:\Data\foo\bar.sd'
  ServiceName = 'bar'
  ServiceType = 'MapServer'
  Folder= 'bar_folder'
  State = 'STARTED'
  Ensure = 'Present'
  PublisherAccount = $arcgisAdminCredential
}
VERBOSE: [pkrvmcz6ng6k1lp]: LCM:  [ Start  Set      ]
VERBOSE: [pkrvmcz6ng6k1lp]: LCM:  [ Start  Resource ]  [[ArcGIS_Server_Service]bar]
VERBOSE: [pkrvmcz6ng6k1lp]: LCM:  [ Start  Test     ]  [[ArcGIS_Server_Service]bar]
WARNING: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] The names of some imported commands from the module 'ArcGISUtility' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] Check for existence of ServiceName:- bar ServiceType:- MapServer Folder:- bar_folder
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] Service with name 'bar' of type 'MapServer' not found in folder 'bar_folder'
VERBOSE: [pkrvmcz6ng6k1lp]: LCM:  [ End    Test     ]  [[ArcGIS_Server_Service]bar]  in 0.8040 seconds.
VERBOSE: [pkrvmcz6ng6k1lp]: LCM:  [ Start  Set      ]  [[ArcGIS_Server_Service]bar]
WARNING: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] The names of some imported comm
ands from the module 'ArcGISUtility' include unapproved verbs that might make them less discoverable. To find the commands
 with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type
 Get-Verb.
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] https://pkrvmcz6ng6k1lp:6443
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] Check for existence of ServiceName:- bar ServiceType:- MapServer Folder:- bar_folder
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] [DEBUG] Services:-
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] Publishing service ‘bar' of type 'MapServer' to 'bar_folder/bar/MapServer'
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] Item does not exist - uploading file C:\Data\foo\bar.sd
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] Uploaded item successfully i67b0e53d-c3a5-48bb-8d12-7a9a84dfa8fc
VERBOSE: [pkrvmcz6ng6k1lp]: [[ArcGIS_Server_Service]bar] [DEBUG] Job:- {"jobId":"jfb40454719aa4d59a6a5fb4808804e70","jobStatus":"esriJobSubmitted"}
VERBOSE: [pkrvmcz6ng6k1lp]: LCM:  [ End    Set      ]  [[ArcGIS_Server_Service]bar]  in 6.1480 seconds.

PowerShell DSC resource ArcGIS_Server_Service  failed to execute Set-TargetResource functionality with error message: 
Service failed to publish. Last Job Status Submitted. Executing... Executing (Publish Service Definition): 
PublishServiceDefinition i67b0e53d-c3a5-48bb-8d12-7a9a84dfa8fc # # Start Time: Wed May  1 20:38:23 2019 Getting server 
information (server folders, data stores, etc.). Validating service definition. WARNING 086222: Output directory in 
service definition is not set or is invalid. Using default output directory. ERROR 001369: Failed to create the service. 
Failed to execute (Publish Service Definition). Failed at Wed May  1 20:38:24 2019 (Elapsed Time: 0.18 seconds) Failed. 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost
@PleaseStopAsking
Copy link
Contributor Author

Further testing shows that if I run the configuration once more without any changes, it will successfully complete on the second run.

@PleaseStopAsking
Copy link
Contributor Author

Reviewing calls from ArcGIS Server Manager when publishing an .sd file shows that the folder must be created as a separate task before publishing takes place within the Submit-ArcGISPublishJob function.

Invoke-ArcGISWebRequest -Url ("$($Scheme)://$($ServerHostName):$Port/$ServerContext" + '/rest/services/System/PublishingTools/GPServer/Publish%20Service%20Definition/submitJob') `
-HttpFormParameters @{ f = 'json'; token = $Token; in_sdp_id = $ItemId } -Referer $Referer

Also, the call to publish the .sd file is passing the in_sdp_id parameter only which is why the service is getting published to the ROOT directory and not into the specified folder. To publish to a given folder, I believe the parameter in_config_overwrite must be passed as well to indicate the folder such as the following (not tested).

{
    "folderName": "foo",
    "service": {
        ...
    }
}

@shailesh91
Copy link
Contributor

@PleaseStopAsking were you able to get this to work?

@PleaseStopAsking
Copy link
Contributor Author

@shailesh91 No, my team would not approve the time to fix this so I ended up building a python script (had an existing script to start from) to handle the publishing and am just calling it from a Script resource.

@cameronkroeker
Copy link
Contributor

fixed in v3.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants