Skip to content
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

Problem adding timeperiod #11

Open
petrovicboban opened this issue Aug 16, 2016 · 2 comments
Open

Problem adding timeperiod #11

petrovicboban opened this issue Aug 16, 2016 · 2 comments
Assignees
Labels

Comments

@petrovicboban
Copy link
Contributor

$ cat /tmp/timeperiods 
[
  {
    "thursday" : "00:00-24:00", 
    "wednesday" : "00:00-24:00", 
    "friday" : "00:00-24:00", 
    "sunday" : "00:00-24:00", 
    "alias": "Always-2", 
    "monday" : "00:00-24:00", 
    "tuesday" : "00:00-24:00", 
    "timeperiod_name": "24x7-2", 
    "saturday" : "00:00-24:00"
  }
]

$ curl -X POST -d @/tmp/timeperiods  -H "content-type: application/json" 'http://admin:[email protected]:8080/timeperiod'
{
  "results": [
    {
      "404": "unknown attribute: monday"
    }
  ], 
  "summary": {
    "failed": 1, 
    "succeeded": 0, 
    "total": 1
  }
}

unknown attribute: monday wtf??
However, it is possible that this is related to pynag issue I've submited.

@Crapworks
Copy link
Owner

Crapworks commented Aug 16, 2016

Hi @petrovicboban,

This message is generated here. The validate function should prevent malformed api requests to the endpoints. Valid attributes are gathered from pynag here.

Checking the issue you opened for pynag, they (whyever) have put the key AND the value in the key portion of the dictionary. That breaks the whole concept of RESTlos (and any RESTful API as well).

I can't see a real workaround for that right now. So I guess you have to place the timeperiods manually in your config directory (which is one reason why I build RESTlos, you can do things manually with an editor without screwing things up).

Let's see what the pynag guys say about the issue.

Regards,
Christian

@CharlesJUDITH
Copy link

Hi @petrovicboban,

My colleague made a PR for timeperiods: #14

You should try it ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants