Question

Script ACP deployment without downtime: PATCH to AppConfigPackageHandling.svc/AppConfigPackageVirtualSet()/ImportFile

  • 13 December 2022
  • 2 replies
  • 93 views

Userlevel 7
Badge +18

I know the installation script can grab ACPs from a folder location, but this requires downtime.

I know the Aurena GUI application can accept ACP ZIP files, but doing this in a web browser requires a mouse and can’t be scripted. When deploying a lot of ACPs, it’s too easy to miss one.

 

I’d like a process for deploying ACPs in a brutally repeatable fashion (i.e. scripted) without causing end user downtime.

 

So far, I figured out I can POST to this entity set to create a new object:

AppConfigPackageHandling.svc/AppConfigPackageVirtualSet

 

This gives me the Objkey to use for GET requests:

AppConfigPackageHandling.svc/AppConfigPackageVirtualSet(Objkey='0123456789ABCDEF0123456789ABCDEF')

 

I can’t figure out how to build the correct payload for this PATCH request. The debug consoles in Chrome and Firefox aren’t showing me the request payload.

 

What payload does this ImportFile request need?

 

AppConfigPackageHandling.svc/AppConfigPackageVirtualSet(Objkey='0123456789ABCDEF0123456789ABCDEF')/ImportFile

 

After this, I expect to call these and can probably figure out the next steps after I get the binary file uploaded.

POST
AppConfigPackageHandling.svc/UnzipAcpFile

{"Objkey":"D7318EB043244082AC0813F5F52516A9"}

 

POST

AppConfigPackageHandling.svc/AppConfigPackageSet(PackageId='{PackageId}')/IfsApp.AppConfigPackageHandling.AppConfigPackage_Publish

 


2 replies

Userlevel 7
Badge +18

I got the binary ZIP upload working.

 

# I tested this in PowerShell 7.3.
# JSON behavior might be a little different if you're on a different version.

Install-Module powershell-yaml

$ifscloud_values_path = '\\ims_server.example.com\c$\IFS\PRD\UB1-MWS-2213UB\ifsroot\config\ifscloud-values.yaml'

$ifscloud_values = Get-Content -Path $ifscloud_values_path -Raw
$ifscloud_values = $ifscloud_values | ConvertFrom-Yaml

$basic_username = 'IFSADMIN'
$basic_password = $ifscloud_values.ifscore.passwords.ifsadminpassword.data
$credential_plaintext = "$($basic_username):$($basic_password)"
$credential_bytes = [System.Text.Encoding]::UTF8.GetBytes($credential_plaintext)
$credential_base64 = [Convert]::ToBase64String($credential_bytes)
$hostname = $ifscloud_values.global.systemurl
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Basic $($credential_base64)")

$global:hostname = $hostname
$global:headers = $headers

Function Post-Projection {
param($service_and_set, $body_hashtable)
$uri = 'https://' + $global:hostname +
'/main/ifsapplications/projection/v1/' + $service_and_set
$body = $body_hashtable | ConvertTo-Json -Compress
If (!$body) {
$body = '{}'
}
$method = 'POST'
$response =
Invoke-RestMethod `
-Uri $uri -Method $method -Headers $global:headers -Body $body
$response
}

Function Patch-ProjectionBinary {
param($service_and_set, $etag, $payload_path)
$headers_local = $global:headers
$headers_local.Remove('If-Match') | Out-Null
$headers_local.Add("If-Match", $etag)
$uri = 'https://' + $global:hostname +
'/main/ifsapplications/projection/v1/' + $service_and_set
$method = 'PATCH'
$response = `
Invoke-RestMethod `
-Uri $uri -Method $method -Headers $headers_local -Infile $payload_path
$response
}

$post_response = Post-Projection `
-service_and_set 'AppConfigPackageHandling.svc/AppConfigPackageVirtualSet' `
-body_hashtable $(@{
'Name' = 'Cloud upgrade project'
'Version' = '1.0'
'Author' = 'Acme'
'Origin' = 'PRDCDB-123456-acmeprd'
'Description' = 'Cloud upgrade project'
})
$etag = $post_response.'@odata.etag'


$file_path = 'C:\my_acps\acp001.zip'
$patch_response = Patch-ProjectionBinary `
-service_and_set `
$('AppConfigPackageHandling.svc/AppConfigPackageVirtualSet' +
"(Objkey='$($objkey)')/ImportFile") `
-etag $etag `
-payload_path $file_path

 

Userlevel 6
Badge +18

One other suggestion that might be open to you is to use an RPA tool to automate the Aurena interactions.  Perfect use of RPA if you have one available, and easily repeatable.

Nick

Reply