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

Missing pParams in resource processor phase method #619

Open
janihur opened this issue Nov 7, 2024 · 3 comments
Open

Missing pParams in resource processor phase method #619

janihur opened this issue Nov 7, 2024 · 3 comments
Labels
bug Something isn't working customer documentation Improvements or additions to documentation

Comments

@janihur
Copy link

janihur commented Nov 7, 2024

This is v0.7.3

I'm exploring an idea to use IPM to load module's installation env/site specific configuration.

I run into issue with parameters in resource processor. I have a simple processor Company.IPM.Config that only dumps information:

Method OnAfterPhase(pPhase As %String, ByRef pParams) As %Status
{
	write !
	write $classname(), ": OnAfterPhase(): phase: ", pPhase
	write !
	write $classname(), ": OnAfterPhase(): pParams: ", ..mdToString(.pParams)
	write !
	write $classname(), ": OnAfterPhase(): properties: ", ..propertiesToString()
	write !
	return $$$OK
}

In manifest:

<Resource Name="config" ProcessorClass="Company.IPM.Config"/>

I have RootDirectory parameter available when I'm loading the module:

zpm:IPM-TRIAL>load /home/irisowner/work/ipm-trial/company-module

[IPM-TRIAL|company-module]  Reload START (/home/irisowner/work/ipm-trial/company-module/)
Company.IPM.Config: OnAfterPhase(): phase: Reload
Company.IPM.Config: OnAfterPhase(): pParams: (md("DeveloperMode") 1)(md("RootDirectory") /home/irisowner/work/ipm-trial/company-module/)(md("cmd") load)
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Reload SUCCESS
[company-module]       Module object refreshed.
[IPM-TRIAL|company-module]  Validate START
Company.IPM.Config: OnAfterPhase(): phase: Validate
Company.IPM.Config: OnAfterPhase(): pParams: (md("DeveloperMode") 1)(md("RootDirectory") /home/irisowner/work/ipm-trial/company-module/)(md("cmd") load)
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Validate SUCCESS
[IPM-TRIAL|company-module]  Compile START
Company.IPM.Config: OnAfterPhase(): phase: Compile
Company.IPM.Config: OnAfterPhase(): pParams: (md("DeveloperMode") 1)(md("RootDirectory") /home/irisowner/work/ipm-trial/company-module/)(md("cmd") load)
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Compile SUCCESS
[IPM-TRIAL|company-module]  Activate START
[IPM-TRIAL|company-module]  Configure START
Company.IPM.Config: OnAfterPhase(): phase: Configure
Company.IPM.Config: OnAfterPhase(): pParams: (md("DeveloperMode") 1)(md("RootDirectory") /home/irisowner/work/ipm-trial/company-module/)(md("cmd") load)
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Configure SUCCESS
Company.IPM.Config: OnAfterPhase(): phase: Activate
Company.IPM.Config: OnAfterPhase(): pParams: (md("DeveloperMode") 1)(md("RootDirectory") /home/irisowner/work/ipm-trial/company-module/)(md("cmd") load)
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Activate SUCCESS

But when I'm running only activate lifecycle to configure the module pParams is empty and now I don't know anymore where on the fileystem I can find config (directory) resource:

zpm:IPM-TRIAL>module-action company-module activate -only

[IPM-TRIAL|company-module]  Activate START
[IPM-TRIAL|company-module]  Configure START
Company.IPM.Config: OnAfterPhase(): phase: Configure
Company.IPM.Config: OnAfterPhase(): pParams:
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Configure SUCCESS
Company.IPM.Config: OnAfterPhase(): phase: Activate
Company.IPM.Config: OnAfterPhase(): pParams:
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Activate SUCCESS
zpm:IPM-TRIAL>

The plan is to have the resource processor to depend on -Denv value and act accordingly.

Second issue is why Denv=foo is expanded also to Dzpm.env=foo:

 pParams: (md("env") foo)(md("zpm","env") foo)
zpm:IPM-TRIAL>module-action company-module activate -only -Denv=foo

[IPM-TRIAL|company-module]  Activate START
[IPM-TRIAL|company-module]  Configure START
Company.IPM.Config: OnAfterPhase(): phase: Configure
Company.IPM.Config: OnAfterPhase(): pParams: (md("env") foo)(md("zpm","env") foo)
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Configure SUCCESS
Company.IPM.Config: OnAfterPhase(): phase: Activate
Company.IPM.Config: OnAfterPhase(): pParams: (md("env") foo)(md("zpm","env") foo)
Company.IPM.Config: OnAfterPhase(): properties: (Name "config")

[IPM-TRIAL|company-module]  Activate SUCCESS
zpm:IPM-TRIAL>
@janihur
Copy link
Author

janihur commented Nov 7, 2024

The workaround (?) is to pass the root directory as an attribute:

<Resource Name="config" ProcessorClass="Company.IPM.Config" RootDirectory="${root}"/>

Or:

<Resource Name="${root}/config" ProcessorClass="Company.IPM.Config"/>

@isc-tleavitt
Copy link
Contributor

I'd call the workaround the current supported approach, but I think pParams would be good to have too.

@janihur
Copy link
Author

janihur commented Nov 8, 2024

From a dummy (?) user perspective as long as the rules are not explained in the documentation I consider it's a bug that:

  • sometimes the data is available and sometimes it's not
  • -Denv expands both env and zpm.env global subscripts

@isc-tleavitt isc-tleavitt added bug Something isn't working documentation Improvements or additions to documentation customer labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working customer documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants