Can I use some kind of script to create image and ghost my lab machines
-
Cancel all tasks of types 1 or 2 curl --silent -X DELETE -H 'content-type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/task/cancel -d '{"typeID": [1,2] }'
-
Set host IDs 1 2 and 3 to image ID 1 curl --silent -k -H 'Content-Type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/image/1/edit -X PUT -d '{"hosts": [1,2,3]}'
-
Get task status of host ID 1 curl --silent -X GET -H 'content-type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/task/active -d '{"hostID": [1]}'
-
Capture image from host id 1 curl --silent -k --header 'content-type: application/json' --header 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' --header 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/host/1/task --data '{"taskTypeID":2,"shutdown": true}'
-
Cancel tasks for a single host of ID 1 curl --silent -X GET -H 'content-type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/task/cancel -d '{"hostID": [1]}'
-
Deploy an image to a single host with the name testhost1 curl --silent -k -H 'Content-Type: application/json' -H 'fog-user-token: ZjBkMmE3YmI5NmUzZDcxYTliYzNkZTc4MmJhNTFiYTQ3Mzc2MTg5MzYxMThmNjA5NDYyMjllMTA5YzE0NWUxMjFiNzkyMTc5OTMwZjFhZGM5NWIxMTc3YWZmNTU2MmMwYjFhNjg0NjVmMTkyMGZkNDQxYmY0MzI1NWNkMzQyM2M=' -H 'fog-api-token: MzI2NDY1NjY2NjM0MzUzMDMzMzA2MzM1MzEzNzYyMzg2NTYyNjQ2MjMxMzczMTM0NjY2NDM0NjUzOTM2NjIzNDM4MzQ2NDM3MzY2MzM2MzMzNjYyMzUzODY0MzUzNDYyMzgzMDY2NjQzNTMxMzI2MzM5NjYzNjYzMzMzMzM0MzA=' http://10.0.0.28/fog/host/testhost1/task -d '{"taskTypeID":1,"shutdown": true}'
-
@AndrewG78 We need volunteers to write some documentation. For the multicasting problem, it may not be implemented into the API yet - I’m not sure.
Here are my example commands I promised:
FOG Server IP in these examples is 10.0.0.28 and the keys you see in here are my test keys on my test server at home. I left them in there so everyone can have a valid example. 1 is the FOG ID of the host in FOG, testhost1 is the hostname.
#wiki worthy
Also pinging @Moderators and @Testers just so they get exposure.
-
HI,
Are there any news regarding API implementation?
I wanted to read changelog of RC versions, but keep getting 502 Bad Gateway.
Andrew -
@andrewg78 AFAIK no changes have been made to the API since 1.4.4 was released. The 1.5.0 branch has a few minor bug fixes, but was mainly focused on the new web gui.
-
@george1421 Thank you. I have 1.4.2 . Do you maybe know if there are some changes in API between my version and 1.4.4 ?
https://news.fogproject.org/fog-1-4-4-officially-released/ keeps popping out 502 error -
@andrewg78 There were some tweaks to the API between 1.4.2 and 1.4.4, but I can’t tell you off the top of my head. You would be better to move to 1.4.4 anyway outside of the API stuff. There were some issues with 1.4.2 that was address in 1.4.3 and finally in 1.4.4.
The developers are still on holiday, but let me see if I can ping one of them to kickstart the news server.
-
May u please validate my curl command?
I keep getting same error as I mentioned few months ago.
{
“error”: “Invalid tasking type passed”
}I’m trying to task multicast process.
curl --header “fog-api-token: <token>=” --header “fog-user-token: <token>=” --data ‘{“taskTypeID”:8}’ -X POST http://<IP>/fog/group/2/task
-
@Wayne-Workman any ideas since you have been working with the API more than most?
-
@andrewg78 The tokens should not have an “equals” symbol added. My examples have an equals at the end because that was coincidentally part of the token. So if you’re adding an equals, remove that.
And you’re missing this header:
-H 'Content-Type: application/json'
-
@Wayne-Workman Hi, thx but " " are needed. I think they depends on the curl version(I’m on WIndows). Without “equals” I got “can not resolve host” error. Moreover, my command gets proper response from the server that tasking type is invalid. I assume API does not support multicast yet. Please confirm that. If you have something not committed to repo yet, please do commit it, as I can test it. Doing CI integration through Jenkins now
-
@andrewg78 The API supports multicast. The documentation here shows us how: https://news.fogproject.org/simplified-api-documentation/
You must specify multicastsession as the task type. This is how:
curl --silent -k -H 'Content-Type: application/json' -H 'fog-user-token: NTcwZTkwYzA5ZDE5NGI0ZTQ3NDgzYzE5ZmM5YWZiZjU5YmZjNjcxMzhiODNlMDczNTlhMWNiNjIxNDVlYmM4ZmZjMGVlOTFiNmUzNzFkNjY5ZmFjNzViMjRiNmJiNWNlM2JiYTM3ZDIxNzk3N2Y3YmM5N2JkM2U4ODZhODdmZjk=' -H 'fog-api-token: M2JhM2ViZmJhZDM1MmQ1MTU4NTNjMTNmZjY4YTY3MGUxMTZmNzgyMmQxYzlhOWMwMmRjMTg0NWNmYTE4MmZiY2FkNjFjYzY1ZjY5NGQ4ZTE1Yjk4ZTg5NTQ0YTBiYmIwYzFjYmFiNTFiYzkwZTQ0YzI5MzFlNWM0NzhmMzEyNTk=' http://10.0.0.28/fog/group/1/multicastsession
-
@Wayne-Workman
Thx, I’ve tried this, and there is no any action
I have no error but task is not being created.
curl --header “Content-Type: application/json” --header “fog-api-token: <my_token>” --header “fog-user-token: <my_token>” --data ‘{“taskTypeID”:8}’ -X POST http://<IP>/fog/group/3/multicastsession -
@AndrewG78 Anything you see in the apache error logs when running the curl command?
-
@andrewg78 Yes, please check the apache error logs. The command I posted did work on my home fog server.
-
@andrewg78 I don’t think you need the
--data '{"taskTypeID": 8}'
though it shouldn’t really matter. Is there any return output from the command losing teh --silent component should show you what’s going on more directly.Something like:
curl -vvv -H 'Content-Type: application/json' -H 'fog-api-token: <my_token>' -H 'fog-user-token: <my_token>' http://<IP>/fog/group/3/task -X POST --data '{"taskTypeID": 8}'