Skip to content

Commit

Permalink
Merge branch 'branches/rudder/8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
clarktsiory committed Oct 4, 2024
2 parents 7f72f4c + a2cf72a commit 6a5c330
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import com.normation.rudder.facts.nodes.ChangeContext
import com.normation.rudder.facts.nodes.NodeFactRepository
import com.normation.rudder.facts.nodes.QueryContext
import com.normation.rudder.properties.MergeNodeProperties
import com.normation.rudder.properties.NodePropertiesService
import com.normation.rudder.properties.PropertiesRepository
import com.normation.rudder.repository.CategoryAndNodeGroup
import com.normation.rudder.repository.RoNodeGroupRepository
Expand Down Expand Up @@ -86,6 +87,7 @@ import zio.syntax.*

class GroupsApi(
readGroup: RoNodeGroupRepository,
propertiesService: NodePropertiesService,
restExtractorService: RestExtractorService,
zioJsonExtractor: ZioJsonExtractor,
uuidGen: StringUuidGenerator,
Expand Down Expand Up @@ -532,6 +534,8 @@ class GroupsApi(
restGroup <- zioJsonExtractor.extractGroup(req).chainError(s"Could not extract a group from request.").toIO
id <- NodeGroupId.parse(sid).toIO
res <- serviceV14.updateGroup(restGroup.copy(id = Some(id)), params, authzToken.qc.actor)
// await all properties update to guarantee that properties are resolved after group modification
_ <- propertiesService.updateAll()
} yield {
res
}).toLiftResponseOne(params, schema, s => Some(s.id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import com.normation.rudder.facts.nodes.QueryContext
import com.normation.rudder.facts.nodes.SelectFacts
import com.normation.rudder.facts.nodes.SelectNodeStatus
import com.normation.rudder.properties.MergeNodeProperties
import com.normation.rudder.properties.NodePropertiesService
import com.normation.rudder.properties.PropertiesRepository
import com.normation.rudder.reports.ReportingConfiguration
import com.normation.rudder.reports.execution.AgentRunWithNodeConfig
Expand Down Expand Up @@ -151,13 +152,14 @@ import zio.syntax.*
* but make the implementation directly here.
*/
class NodeApi(
zioJsonExtractor: ZioJsonExtractor,
serializer: RestDataSerializer,
nodeApiService: NodeApiService,
userPropertyService: UserPropertyService,
inheritedProperties: NodeApiInheritedProperties,
uuidGen: StringUuidGenerator,
deleteDefaultMode: DeleteMode
zioJsonExtractor: ZioJsonExtractor,
nodePropertiesService: NodePropertiesService,
serializer: RestDataSerializer,
nodeApiService: NodeApiService,
userPropertyService: UserPropertyService,
inheritedProperties: NodeApiInheritedProperties,
uuidGen: StringUuidGenerator,
deleteDefaultMode: DeleteMode
) extends LiftApiModuleProvider[API] {

def schemas: ApiModuleProvider[API] = API
Expand Down Expand Up @@ -387,6 +389,8 @@ class NodeApi(
restNode <- restExtractor.extractUpdateNode(req).toIO
reason <- extractReason(req)
result <- nodeApiService.updateRestNode(NodeId(id), restNode)
// await all properties update to guarantee that properties are resolved after node modification
_ <- nodePropertiesService.updateAll()
} yield {
result.transformInto[JRUpdateNode]
}).chainError(s"An error occurred while updating Node '${id}'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ class RestTestSetUp {
new GroupsInternalApi(groupInternalApiService),
new NodeApi(
zioJsonExtractor,
mockNodeGroups.propService,
restDataSerializer,
nodeApiService,
userPropertyService,
Expand All @@ -962,6 +963,7 @@ class RestTestSetUp {
),
new GroupsApi(
mockNodeGroups.groupsRepo,
mockNodeGroups.propService,
restExtractorService,
zioJsonExtractor,
uuidGen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,7 @@ object RudderConfigInit {
new ComplianceApi(restExtractorService, complianceAPIService, roDirectiveRepository),
new GroupsApi(
roLdapNodeGroupRepository,
propertiesService,
restExtractorService,
zioJsonExtractor,
stringUuidGenerator,
Expand All @@ -2085,6 +2086,7 @@ object RudderConfigInit {
),
new NodeApi(
zioJsonExtractor,
propertiesService,
restDataSerializer,
nodeApiService,
userPropertyService,
Expand Down

0 comments on commit 6a5c330

Please sign in to comment.