Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaadF committed Mar 18, 2020
1 parent 8d8a4e9 commit 1ceb1f8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Expand Up @@ -56,6 +56,7 @@ trait WoNodeRepository {
def updateNode(node: Node, modId: ModificationId, actor:EventActor, reason:Option[String]) : IOResult[Node]

def createNode(node: Node, modId: ModificationId, actor:EventActor, reason:Option[String]) : IOResult[Node]
def deleteNode(node: Node, modId: ModificationId, actor:EventActor, reason:Option[String]) : IOResult[Node]



Expand Down
Expand Up @@ -54,6 +54,7 @@ import com.normation.inventory.domain.KeyStatus
import com.normation.inventory.domain.NodeId
import com.normation.inventory.domain.SecurityToken
import com.normation.inventory.ldap.core.InventoryDit
import com.normation.rudder.domain.RudderDit
import zio._
import zio.syntax._

Expand All @@ -63,6 +64,7 @@ class WoLDAPNodeRepository(
, mapper : LDAPEntityMapper
, ldap : LDAPConnectionProvider[RwLDAPConnection]
, actionLogger : EventLogRepository
, rudderDit : RudderDit
) extends WoNodeRepository with NamedZioLogger {
repo =>

Expand Down Expand Up @@ -189,8 +191,19 @@ class WoLDAPNodeRepository(
val entry = mapper.nodeToEntry(node)
for {
con <- ldap
res <- con.save(entry).chainError(s"Error when trying to save node in promote to relay ${entry.dn}")
_ <- IOResult.effect(println(s"----- ENTRY : $entry"))
_ <- IOResult.effect(println(s"----- RESULT : $res"))
} yield {
node
res <- con.save(entry).chainError(s"Error when trying to save node '${entry.dn}")
}
}

override def deleteNode(node: Node, modId: ModificationId, actor: EventActor, reason: Option[String]): IOResult[Node] = {
val entry = rudderDit.NODE_CONFIGS.dn
for {
con <- ldap
res <- con.delete(entry).chainError(s"Error when trying to delete node '${node.id.value}")
} yield {
node
}
Expand Down
Expand Up @@ -1532,6 +1532,7 @@ object RudderConfig extends Loggable {
, ldapEntityMapper
, rwLdap
, logRepository
, rudderDit
)

private[this] lazy val roLdapNodeGroupRepository = new RoLDAPNodeGroupRepository(
Expand Down

0 comments on commit 1ceb1f8

Please sign in to comment.