Discussion
· Feb 21, 2021

Install ZPM in one line

Hi developers.
I often miss the ZPM program on a clean system.
Nothing complicated? Take and install.
And in one line? Especially in a docker container.
There is a solution. I'm very happy with it;)
Maybe the line can be shortened?

set $namespace="%SYS", name="DefaultSSL" do:'##class(Security.SSLConfigs).Exists(name) ##class(Security.SSLConfigs).Create(name) set url="https://pm.community.intersystems.com/packages/zpm/latest/installer" Do ##class(%Net.URLParser).Parse(url,.comp) set ht = ##class(%Net.HttpRequest).%New(), ht.Server = comp("host"), ht.Port = 443, ht.Https=1, ht.SSLConfiguration=name, st=ht.Get(comp("path")) quit:'st $System.Status.GetErrorText(st) set xml=##class(%File).TempFilename("xml"), tFile = ##class(%Stream.FileBinary).%New(), tFile.Filename = xml do tFile.CopyFromAndSave(ht.HttpResponse.Data) do ht.%Close(), $system.OBJ.Load(xml,"ck") do ##class(%File).Delete(xml)
Discussion (12)2
Log in or sign up to continue

Oh, how unexpected! Let's cut it down a bit to get another nice number of characters.

zn "%SYS",n="SL" d:'##class(Security.SSLConfigs).Exists(n) ##class(Security.SSLConfigs).Create(n) s u="https://pm.community.intersystems.com/packages/zpm/latest/installer" D ##class(%Net.URLParser).Parse(u,.c) s h=##class(%Net.HttpRequest).%New(),h.Server=c("host"),h.Port=443,h.Https=1,h.SSLConfiguration=n,s=h.Get(c("path")) q:'s $System.Status.GetErrorText(s) s x=##class(%File).TempFilename("xml"),f=##class(%Stream.FileBinary).%New(),f.Filename=x d f.CopyFromAndSave(h.HttpResponse.Data) d h.%Close(),$system.OBJ.Load(x,"ck") do ##class(%File).Delete(x)

I think, there is a "small problem" at start...

zn "%SYS",n=SL ...

will not work as expected ;-))

but what about this line with 552 chars

zn "%SYS" s n="SL" d ##class(Security.SSLConfigs).Create(n):'##class(Security.SSLConfigs).Exists(n),##class(%Net.URLParser).Parse("https://pm.community.intersystems.com/packages/zpm/latest/installer",.c) s h=##class(%Net.HttpRequest).%New(),h.Server=c("host"),h.Port=443,h.Https=1,h.SSLConfiguration=n,s=h.Get(c("path")) q:'s $System.Status.GetErrorText(s) s x=##class(%File).TempFilename("xml"),f=##class(%Stream.FileBinary).%New(),f.Filename=x d f.CopyFromAndSave(h.HttpResponse.Data) d h.%Close(),$system.OBJ.Load(x,"ck") do ##class(%File).Delete(x)

I only rewrote your line, but haven't tried to execute

I tried the line on my local windows IRIS install and I am getting the following error...

ERROR #5002: ObjectScript error: <METHOD DOES NOT EXIST>zGetInstallerProperties+11^%ZPM.PackageManager.Developer.Utils.1 *%GetData,%SQL.StatementResult
  > ERROR #5574: Error reported while running generator for parameter '%ZPM.PackageManager.Developer.Processor.CSPApplication:ATTRIBUTES'
    > ERROR #5030: An error occurred while compiling class '%ZPM.PackageManager.Developer.Processor.CSPApplication'
Detected 1 errors during load.
2022-06-30 14:58:21 0 %ZPM.Installer: ERROR #5002: ObjectScript error: <METHOD DOES NOT EXIST>zGetInstallerProperties+11^%ZPM.PackageManager.Developer.Utils.1 *%GetData,%SQL.StatementResult
  > ERROR #5574: Error reported while running generator for parameter '%ZPM.PackageManager.Developer.Processor.CSPApplication:ATTRIBUTES'
    > ERROR #5030: An error occurred while compiling class '%ZPM.PackageManager.Developer.Processor.CSPApplication'
2022-06-30 14:58:21 0 %ZPM.Installer: Installation failed at 2022-06-30 14:58:21
2022-06-30 14:58:21 0 %Installer: Elapsed time 10.222858s
Time spent 10.295294
ERROR #5002: ObjectScript error: <METHOD DOES NOT EXIST>zGetInstallerProperties+11^%ZPM.PackageManager.Developer.Utils.1 *%GetData,%SQL.StatementResult
  > ERROR #5574: Error reported while running generator for parameter '%ZPM.PackageManager.Developer.Processor.CSPApplication:ATTRIBUTES'
    > ERROR #5030: An error occurred while compiling class '%ZPM.PackageManager.Developer.Processor.CSPApplication'
      > ERROR #5090: An error has occurred while creating projection %ZPM.Installer:Reference.
Detected 1 errors during load.