Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 34 additions & 22 deletions documentation/SolutionsRegistryFormat.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Each entry in the solution registry should have a unique ID (`Solution.id` in th
"start": [ .. ],
"stop": [ .. ],
"isInstalled": [ .. ],

"isConfigurable": [ ... ],
"makeConfigurable": [ ... ]

// Not yet supported. Post-Cloud4All features.
"install": [ ... ],
"uninstall": [ ... ],
"makeConfigurable": [ ... ],
"isRunning": [ ... ],
"isConfigurable": [ ... ]
}
```

Expand Down Expand Up @@ -143,6 +143,37 @@ This directive is used to detect whether a solution is installed. If any of thes
]
```

####isConfigurable
This is run before configuration to ensure that the application is actually ready to be configured. This is relevant for applications where e.g. a configuration file needs to be present, a wizard needs to be run on the first launch, etc. Each of the blocks will be evaluated, if *any* of them evaluates to true, the solution is considered configurable. The absence of an `isConfigurable` block is also interpreted as the solution being configurable.

If a solution is not configurable, the `makeConfigurable` block will be executed immediately following the `isConfigurable` check (see below).

**Example Entry**:
```
"isConfigurable": [
{
"type": "gpii.lifecycleActions.pathExists",
"path": "/tmp/fakemag1.settings.json"
}
]
```

####makeConfigurable
Is the actions that need to be taken to make the application configurable (such as running a wizard, creating a default configuration file, adding a new system user, etc). This will be triggered by the system if `isConfigurable` has evaluated to false and run immediately following the `isConfigurable` check.

**Example Entry**:
```
"makeConfigurable": [
{
"type": "gpii.lifecycleActions.createFile",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these examples now refer to nonexistent functions. I think it would be better to reinstate them, with some tests, so that we create a facility which is actually usable. Don't we have an actual use case for this feature - if not, why are we implementing it? Unfortunately GPII-1885 is a TLJ so the reason why it is on our roadmap is unclear.

Could you please
i) Flesh out GPII-1885 by adding or linking to information explaining why we are implementing it
ii) Write up a JIRA for the facility of being able to invoke settingsHandlers from the makeConfigurable/isConfigurable blocks together with a sketch of what this might look like

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the feedback @amb26. I've updated GPII-1885 with more details now, and created (and linked) GPII-2057 for the settingshandler work. Would you suggest that I just fix 2057 while I'm at it - together with and implementation of gpii.lifecycleActions.pathExists, these might make for some good examples and useful functionality

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it sounds good - we may as well verify that this functionality is actually good for something, since it is no longer good for the original use case. Is it possible that the ORCA settings handler might be the only genuine use for this function in our current solutions? If we can demonstrate that we can simplify the logic there and have it simply consist of the JSON settings handler, then we have a reasonable win. If we can't actually find a single genuine use of this system, I wonder whether we shouldn't mothball it. I know it's an awful thing to suggest given you have put so much work into this pull, but I think it is desirable to keep the principle that any code we have in the codebase meets at least one real use case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no - I completely agree, that if there is no proper use case it should be mothballed, else it'll just pollute the code base, risk going stale, etc..

I talked with @javihernandez yesterday, and it does indeed seem that ORCA (and, I believe NVDA) needs extra actions the first time they're used. Though the use case there is that they need to be started and then stopped (which will trigger their initial setup routine), before the settings are set. Anyway, I'll let him confirm/unconfirm this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can confirm that behavior with both Orca and NVDA. Isn't it a good use case?
Can't we just move my implementation of "makeConfigurable" (https://github.com/GPII/linux/blob/a0acb4730edd0382dfd2010a9a713cff29268523/gpii/node_modules/orca/orcaSettingsHandler.js#L118) into a utility function in universal that can be used by any application that requires a start/stop cycle before being configured? By having this and by adding a few improvements to the JSON settings handler (mostly, being able to write the settings in the right profile), the infamous orca settings handler would disappear for the rest of the days 💃

"options": {
"filename": "/tmp/fakemag1.settings.json",
"content": "{}"
}
}
]
```

*****

### UNIMPLEMENTED BLOCKS
Expand All @@ -161,26 +192,7 @@ To detect whether a solution is running - this is planned to be integrated in th
]
```

####isConfigurable
This is run before configuration to ensure that the application is actually ready to be configured. This is relevant for applications where e.g. a configuration file needs to be present, a tutorial needs to be run on the first launch, etc.

**Example Entry**:
```
"isConfigurable": [{
"type": "gpii.reporter.fileExists",
"path": "${{environment}.XDG_DATA_HOME}/orca/user-settings.conf""
}]
```

####makeConfigurable
Is the actions that need to be taken to make the application configurable (such as running a wizard, creating a default configuration file, adding a new system user, etc).

**Example Entry**:
```
"makeConfigurable": [{
"launch" // A special key meaning "start it, wait until isConfigurable is met, and then stop it"
}]
```

####install:
Used for describing the steps required for installing the application
Expand Down
31 changes: 31 additions & 0 deletions gpii/node_modules/lifecycleManager/src/LifecycleManager.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 110 additions & 0 deletions gpii/node_modules/lifecycleManager/test/js/LifecycleManagerTests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.