-
Notifications
You must be signed in to change notification settings - Fork 85
Fixes #26861: Migration from Box to ZIO : Refactor XmlUnserialisation #6357
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
Conversation
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
|
PR updated with a new commit |
|
Commit modified |
5d5d85c to
c47cc2c
Compare
|
PR updated with a new commit |
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
|
PR updated with a new commit |
1 similar comment
|
PR updated with a new commit |
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
2234554 to
8a0f048
Compare
...main/scala/com/normation/rudder/services/workflows/CommitAndDeployChangeRequestService.scala
Outdated
Show resolved
Hide resolved
...r-core/src/test/scala/com/normation/rudder/services/marshalling/TestXmlUnserialisation.scala
Outdated
Show resolved
Hide resolved
clarktsiory
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is great having such a migration, it covers already a lot.
There were some other methods in CommitAndDeployChangeRequestServiceImpl that still could be migrated, as propagated changes (to avoid toBox).
Also the XmlUtils API is nice, I have some suggestions to make it easier to use.
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
|
PR updated with a new commit |
...main/scala/com/normation/rudder/services/workflows/CommitAndDeployChangeRequestService.scala
Outdated
Show resolved
Hide resolved
...main/scala/com/normation/rudder/services/workflows/CommitAndDeployChangeRequestService.scala
Outdated
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
|
PR updated with a new commit |
...r-core/src/main/scala/com/normation/rudder/services/marshalling/XmlUnserialisationImpl.scala
Outdated
Show resolved
Hide resolved
|
PR updated with a new commit |
| (config, trigger) <- changeRequest match { | ||
| case config: ConfigurationChangeRequest => | ||
| if (!isMergeableConfigurationChangeRequest(config)) { | ||
| ChangeRequestLogger.info( | ||
| logger.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right above this, there is some code that can be put in the for-comprehension instead :
workflowEnabled().either.runNow match {
case Right(b) => if (b) logger.info(s"Saving and deploying change request ${changeRequest.id.value}")
case _ => ()
}|
PR updated with a new commit |
|
|
||
| for { | ||
| workflowEnabled <- workflowEnabled().toBox | ||
| _ = if (workflowEnabled) logger.info(s"Saving and deploying change request ${changeRequest.id.value}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the logger is pure, so this will just skip the log. It needs to be <-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the for-comprehension likely needs to be for IOResult, and not Box, the toIO at the end should be avoided
|
PR updated with a new commit |
| _ <- workflowEnabled().toBox.map(workflowEnabled => { | ||
| if (workflowEnabled) logger.info(s"Saving and deploying change request ${changeRequest.id.value}") | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will still not do the log, the pure logger needs to be evaluated (the result of this expression is Box[IOResult[Unit]]).
The whole for-comprehension needs to be a IOResult one, there are nested toBox and toIO and we don't want that. In fact the toIO and the end needs to be removed (you will likely need to do saveConfigurationChangeRequest(...).toIO)
|
PR updated with a new commit |
|
OK, squash merging this PR |
#XmlUnserialisationImpl: chain additional error if unserialisation fails ; CmdbQueryParser pure implementation
88fd787 to
e371c1b
Compare
https://issues.rudder.io/issues/26861
This is part of the plan to remove the dependency to the lift library from Rudder and Rudder plugins.
This PR migrates the following classes in XmlUnserialisation :
This change also includes a new
XmlUtilsobject, which offers methods to look up a specific child node or attribute of a given XML node, and the error handling that comes with it. XmlUtils may be used in order to migrate the remaining classes in XmlUnserialisationThis PR is part of the migration from Box to ZIO in change-validation, and is linked to the following PR in the Rudder plugins repository : Normation/rudder-plugins#828