Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
VinceMacBuche committed Oct 12, 2016
1 parent fdc6702 commit 018e410
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ import com.normation.rudder.web.rest.RestUtils
import com.normation.rudder.web.rest.ApiVersion
import com.normation.rudder.web.rest.RestDataSerializer
import com.normation.rudder.domain.nodes.Node
import scala.sys.process.Process
import com.zaxxer.nuprocess.NuProcessBuilder
import com.zaxxer.nuprocess.NuAbstractProcessHandler
import java.nio.ByteBuffer
import java.io.PipedInputStream
import java.io.PipedOutputStream
import java.util.concurrent.TimeUnit
import net.liftweb.http.StreamingResponse
import org.apache.commons.io.IOUtils
import net.liftweb.http.OutputStreamResponse
import java.io.OutputStream

class NodeAPI8 (
apiV6 : NodeAPI6
Expand All @@ -63,6 +74,10 @@ class NodeAPI8 (
serializer.serializeNode(node)
}

def LaunchRun() = {
val p = Process("/tmp/test-script");
p.lineStream
}
val v8Dispatch : PartialFunction[Req, () => Box[LiftResponse]] = {

case id :: Nil JsonPost body -> req => {
Expand Down Expand Up @@ -104,6 +119,11 @@ class NodeAPI8 (
toJsonError(Some(id), fail.messageChain)
}
}

case Post(id :: "applyPolicy" ::Nil, req) =>

Full(OutputStreamResponse((out) => LaunchRun().foreach{ s => out.write((s+"\n").getBytes); out.flush() }))

}

override def requestDispatch(apiVersion: ApiVersion) : PartialFunction[Req, () => Box[LiftResponse]] = {
Expand Down

0 comments on commit 018e410

Please sign in to comment.