These are chat archives for allegro/ralph

14th
Sep 2016
Pete
@kasim1r
Sep 14 2016 15:42
hy, anyone here?
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 15:42
yes
Pete
@kasim1r
Sep 14 2016 15:42
great
i have an API question
what would the correct json look like to create a new virtual server?
here's what I came up with after reading the OPTIONS page
{
"type": 1,
"hostname": "tollemaschine1",
"hypervisor": 2,
"service_env": 3,
"status": "in use",
"sn": "123lkjh1oiuz123jhvfejkbergjb432"
}
but what actually happens is an error 400
{"type":["This field is required."],"hypervisor":["This field is required."]}
i though i had both in there
i also tried "" around the integers
Pete
@kasim1r
Sep 14 2016 15:48
basic misunderstanding of the concept (at my side)?
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 15:48
trying.
Pete
@kasim1r
Sep 14 2016 15:53
very nice of you :)
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 15:53
curl -H "Content-Type: application/json" -H "Authorization: Token 9af03a5ed0eabdc665f00c7043c3913f88d0943b" -XPOST http://ralph-demo.allegro.tech/api/virtual-servers/ -d '{"hypervisor": 810, "type": 4}' -vvv
Pete
@kasim1r
Sep 14 2016 15:54
that worked?
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 15:54
it works on our demo site, remember about Content-Type
if not provided, it wont' work
Pete
@kasim1r
Sep 14 2016 15:55
oh really.... i only had the "Accept" header in there
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 15:56
it's required to specify, because we accept other content types
Zrzut ekranu 2016-09-14 o 17.56.07.png
you can play around using this GUI also
Zrzut ekranu 2016-09-14 o 17.56.25.png
to gather some examples and play with it
Pete
@kasim1r
Sep 14 2016 15:59
ok, and the "accept" and "content-type" headers cannot be mixed, i just realized
next problem right away:
{"hostname":["This field must be unique."],"sn":["This field must be unique."]}
forget it, he already took the request :)
very nice
i'm doing this in Powershell, so bear with me
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 16:01
are you adopting Ralph for some back office purposes ?
Pete
@kasim1r
Sep 14 2016 16:02
yes, we have a cluster of hypervisors, and I want to automate inventory of VMs
nobody wants to sit in front of a web interface to add VMs by hand :)
albeit the web interface is cool
:P
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 16:02
yeah, we did it the same, using bunch of scripts
Pete
@kasim1r
Sep 14 2016 16:03
oh maybe you want to share these scripts ... for shortening the learning curve?
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 16:03
so this API for virtualservers should be sufficient to add complete set of properties
it's very simple, you just discovered 30% of it already, by yourself
Pete
@kasim1r
Sep 14 2016 16:06
do ihave to add ethernets before the VM so that i can "connect" the ethernet to the VM?
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 16:09
i'm not sure..
Pete
@kasim1r
Sep 14 2016 16:12
thanks for your help anyway.
and a hint for the "installation" howto: change "apt-get install mysql-server" to "mysql-server-5.6" or so
because otherwise installtion fails
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 16:13
oh, thanks
we are working on the CLI tool, too, http://ralph-cli.readthedocs.io/en/latest/quickstart/
which helps "discovering" in an automatically manner, devices
Pete
@kasim1r
Sep 14 2016 16:15
aha
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 16:16
but we're currently using it only for phiscal hardware, to discover hardware information
so it cannot create new device, rather update components(cpu, memory, ethernets)
Pete
@kasim1r
Sep 14 2016 16:16
cool, but dracs are in a saprate physical LAN, not routed to infrstructure
so, hypervisors will still have to be manual :)
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 16:17
yeah.
Pete
@kasim1r
Sep 14 2016 16:17
signing off now, thanks again, will surely come back with more questions :)
cucu
✪ vi4m Marcin Kliks
@vi4m
Sep 14 2016 16:18
see you later