Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Conversation

fanf
Copy link
Member

@fanf fanf commented Apr 4, 2017

@VinceMacBuche
Copy link
Member

Can you rebase in one commit ?

@@ -230,6 +230,61 @@ <h4 class="no-margin">
</ul>
</div>
</div>
<div class="form-group">
<label class="bloc"><a ng-click="toggleWell($event)">What to do when a queries for a node returns Error 404 (missing)?<span class="fa fa-chevron-right"></span></a></label>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What to do when a query for a Node returns a 404 error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you prefer

def extractMissingNodeBehavior(json: JValue) : Box[M[MissingNodeBehavior]] = {
val onMissing: Box[MissingNodeBehavior] = (json \ "onMissing" match {
case JNothing => Full(MissingNodeBehavior.Delete)
case JObject(fields) => fields.find( _.name == "name" ) match {
Copy link
Member

@VinceMacBuche VinceMacBuche Apr 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would:

case obj : JObject =>
  obj \ "name" match {
    case JString(Delete.name) => Full(Delete)
    ...
    case JString(Default.name) =>
      obj \ "value" match {
        case JNothing => Failure
        case value => value
      }
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

//we only get the first element from the path.
//if list is empty, return "" (remove property).
DataSource.nodeProperty(datasourceName.value, json.headOption.getOrElse(""))
json.map( list => DataSource.nodeProperty(datasourceName.value, list.headOption.getOrElse("")) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to read it thrice but it's ok :) ( In first attempt, i thought the None (NoChange) would be transformed into "" and would Delete the property but understood !!

MyDatasource.http.queryAll(datasource, c) match {
case Full(res) => //ok
case x => logger.error(s"oh no! Got a $x")
// "Update on datasource" should {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want it to be commented ??? I think we should remove if so

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope :) it was because it took to long when testing, and eclipse does not help a lot to start only one test

@fanf
Copy link
Member Author

fanf commented Apr 5, 2017

PR rebased

@fanf fanf force-pushed the ust_10351/make_datasources_behaviour_on_404_request_configurable branch from 873efba to 6b18d7f Compare April 5, 2017 16:03
@fanf
Copy link
Member Author

fanf commented Apr 5, 2017

PR rebased

@fanf fanf force-pushed the ust_10351/make_datasources_behaviour_on_404_request_configurable branch from 6b18d7f to 361d863 Compare April 5, 2017 16:06
Copy link
Member

@VinceMacBuche VinceMacBuche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Normation-Quality-Assistant

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 361d863 into Normation:branches/rudder/4.1 Apr 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants