Skip to content

Commit

Permalink
Merge branch 'v1' into v1-storage-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-tleavitt committed Apr 30, 2024
2 parents c61ca9c + 6b124a6 commit c9069ae
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- #451: Avoid compliation errors due to storage location conflict on IRIS for Health prior to 2024.1
- #455: Upgrade from %ZPM classes updates language extensions correctly to use %IPM
- #373: Cleaner cross-version approach used in language extension routine generation
- #459: zpm "version" behaves better without internet access

### Security
-
Expand Down
2 changes: 1 addition & 1 deletion src/cls/IPM/Main.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ ClassMethod Version(ByRef pCommandInfo) [ Internal ]
$$$ThrowOnError(tSC)
Set tService = tRepository.GetPackageService()
Set tInfo = tService.GetInfo()
Write !,$$$FormattedLine($$$Blue,tRepository.URL)," - ",tInfo.version
Write !,$$$FormattedLine($$$Blue,tRepository.URL)," - ",tInfo.ToString()
}
Quit $$$OK
}
Expand Down
15 changes: 15 additions & 0 deletions src/cls/IPM/Repo/Remote/Info.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Class %IPM.Repo.Remote.Info Extends (%RegisteredObject, %JSON.Adaptor)
{

Parameter %JSONIGNOREINVALIDFIELD As BOOLEAN = 1;

Property version As %String;

Property available As %Boolean [ InitialExpression = 1 ];

Method ToString() As %String
{
Quit $Select(..available:..version,1:"currently unavailable")
}

}
13 changes: 8 additions & 5 deletions src/cls/IPM/Repo/Remote/PackageService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ Property Password As %String;

Property Token As %String;

Method GetInfo(url As %String) As %DynamicObject
Method GetInfo() As %IPM.Repo.Remote.Info
{
Set tRequest = ..GetHttpRequest()
Set tRequest.Timeout = 2 // Short timeout in case it's unavailable
Set tSC = tRequest.Get()
Set info = ##class(%IPM.Repo.Remote.Info).%New()

If $$$ISOK(tSC), tRequest.HttpResponse.StatusCode=200 {
Set tRes = {}.%FromJSON(tRequest.HttpResponse.Data)
Return tRes
$$$ThrowOnError(info.%JSONImport(tRequest.HttpResponse.Data))
} Else {
Set info.available = 0
}

$$$ThrowStatus($$$ERROR($$$GeneralError,"Registry server not available."))
Return info
}

Method GetLatestModuleVersion(pModuleName As %String) As %String
Expand Down
6 changes: 3 additions & 3 deletions src/cls/IPM/ResourceProcessor/FileCopy.cls
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Method OnBeforePhase(pPhase As %String, ByRef pParams) As %Status
}

If (pPhase = "Activate") && (..InstallDirectory '= "") && ('..Defer) {
Set tSource = $Case(..SourceDirectory, "": ..ResourceReference.Module.Root _ ..ResourceReference.Name,: ..SourceDirectory)
Set tSource = ..ResourceReference.Module.Root _ $Case(..SourceDirectory, "": ..ResourceReference.Name,: ..SourceDirectory)
Set tTarget = ..InstallDirectory
Set tSC = ..DoCopy(tSource, tTarget, .pParams)
If $$$ISERR(tSC) {
Expand All @@ -65,7 +65,7 @@ Method OnAfterPhase(pPhase As %String, ByRef pParams) As %Status
}

If (pPhase = "Activate") && (..InstallDirectory '= "") && (..Defer) {
Set tSource = $Case(..SourceDirectory, "": ..ResourceReference.Module.Root _..ResourceReference.Name,: ..SourceDirectory)
Set tSource = ..ResourceReference.Module.Root _ $Case(..SourceDirectory, "": ..ResourceReference.Name,: ..SourceDirectory)
Set tTarget = ..InstallDirectory
Set tSC = ..DoCopy(tSource, tTarget, .pParams)
If $$$ISERR(tSC) {
Expand Down Expand Up @@ -138,7 +138,7 @@ Method DoCopy(tSource, tTarget, pParams)
Write:tVerbose !,"Copying ",tSource," to ",tTarget
If (copyAsFile) {
If '##class(%File).Exists(tSource) {
Set tSC = $$$ERROR($$$GeneralError, "Source file does not exists: "_tSource)
Set tSC = $$$ERROR($$$GeneralError, "Source file does not exist: "_tSource)
Quit
}
If '##class(%File).CopyFile(tSource, tTarget, 1, .return) {
Expand Down

0 comments on commit c9069ae

Please sign in to comment.