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

IsDirty: Exception when executed without parameters #1751

Closed
edgd1er opened this issue Apr 29, 2024 · 1 comment
Closed

IsDirty: Exception when executed without parameters #1751

edgd1er opened this issue Apr 29, 2024 · 1 comment
Assignees

Comments

@edgd1er
Copy link

edgd1er commented Apr 29, 2024

the return of the command: /usr/sbin/omv-rpc -u admin config isDirty 2>&1| jq .should return true or false. With omv6 it was ok.

Hereunder is the return since I migrated to OMV7. I have the same error on two separate servers.

/usr/sbin/omv-rpc -u admin config isDirty 2>&1| jq .
{
"response": null,
"error": {
"code": 0,
"message": ": The value \"null\" is not an object.",
"trace": "OMV\\Json\\SchemaValidationException: : The value \"null\" is not an object. in /usr/share/php/openmediavault/json/schema.inc:395\nStack trace:\n#0 /usr/share/php/openmediavault/json/schema.inc(289): OMV\\Json\\Schema->validateObject()\n#1 /usr/share/php/openmediavault/json/schema.inc(261): OMV\\Json\\Schema->validateType()\n#2 /usr/share/php/openmediavault/rpc/paramsvalidator.inc(59): OMV\\Json\\Schema->validate()\n#3 /usr/share/php/openmediavault/rpc/serviceabstract.inc(179): OMV\\Rpc\\ParamsValidator->validate()\n#4 /usr/share/openmediavault/engined/rpc/config.inc(59): OMV\\Rpc\\ServiceAbstract->validateMethodParams()\n#5 [internal function]: Engined\\Rpc\\Config->isDirty()\n#6 /usr/share/php/openmediavault/rpc/serviceabstract.inc(122): call_user_func_array()\n#7 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\\Rpc\\ServiceAbstract->callMethod()\n#8 /usr/sbin/omv-engined(535): OMV\\Rpc\\Rpc::call()\n#9 {main}"
}
}

https://github.com/openmediavault/openmediavault/blob/0a326a200927cce1c333ee561537882bee86fc0b/deb/openmediavault/usr/share/openmediavault/engined/rpc/config.inc#L59C3-L59C62

params is validated even if is null or empty:

final protected function validateMethodParams($params, $schema) {

rpc.config.isDisrty model includes information about params not being required:

"type": "rpc",
"id": "rpc.config.isDirty",
"params": {
"type": "object",
"properties": {
"modules": {
"type": "array",
"items": {
"type": "string"
},
"required": false

as mentionned in forum the workaround to use isDirty could be sudo omv-rpc -u admin config isDirty "{\"modules\":$(</var/lib/openmediavault/dirtymodules.json)}" or sudo omv-rpc -u admin config isDirty '{"modules":[]}'

Would it be possible to use isDirty without supplying $params as previously ?

@votdev votdev self-assigned this Apr 29, 2024
votdev added a commit to votdev/openmediavault that referenced this issue May 3, 2024
Note, the whole handling of the `params` argument of the RPC implementation is faulty, but it can not be fixed without breaking existing code and behavior in core and all existing plugins. Therefore, the current implementation will be retained, even if it is wrong. The error is the processing of the `params` argument. This is not converted and processed as PHP objects but converted into an associative array. As a result, the information is lost as to whether it is an empty object or an empty array.

Relates to: openmediavault#1751

Signed-off-by: Volker Theile <votdev@gmx.de>
@votdev
Copy link
Member

votdev commented May 3, 2024

With the PR #1757 the RPC can be called via omv-rpc -u admin config isDirty '{}'. That's all i can do.

@votdev votdev closed this as completed May 3, 2024
votdev added a commit that referenced this issue May 3, 2024
Note, the whole handling of the `params` argument of the RPC implementation is faulty, but it can not be fixed without breaking existing code and behavior in core and all existing plugins. Therefore, the current implementation will be retained, even if it is wrong. The error is the processing of the `params` argument. This is not converted and processed as PHP objects but converted into an associative array. As a result, the information is lost as to whether it is an empty object or an empty array.

Relates to: #1751

Signed-off-by: Volker Theile <votdev@gmx.de>
votdev added a commit that referenced this issue May 9, 2024
Related to: #1751

Signed-off-by: Volker Theile <votdev@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants