Uploading and updating an Image to Confluence using the REST API

If you have automated systems sometimes it is useful to have them interact with your documentation from time to time.  Using the Confluence REST API you can upload an image as an attachment to the page and later update it if required.  If you follow the Atlassian documentation you end up getting a denied request for the update as it wishes for the new file to have a different filename.
Below are the curl lines to post and then update the image.  Change your page ID and attachment ID as required:

curl -D- -k -u $user:$pass -p -H "X-Atlassian-Token: nocheck" -X POST \ 
 -F file=@cake.jpg https://confluence.domain.tld/confluence/rest/api/content/$page_id/child/attachment
curl -D- -k -u $user:$pass -p -H "X-Atlassian-Token: nocheck" -X POST \
 -F file=@cake.jpg https://confluence.domain.tld/confluence/rest/api/content/$page_id/child/attachment/$attach_id/data

In the first request you should have a JSON response with Results->ID->att123456 – the attach_id to be used above is just the numeric part of this string, i.e. 123456.


Getting the latest Vagrant & VirtualBox working together

Having trouble getting the latest Vagrant and VirtualBox working together because the ssh key is not acceptable to Vagrant?  Well it turns out that the ownership on authorized_keys is not 600 so it fails in operating systems like Centos.  The trick is to modify one of the files to add a chmod 0600 after the authorized_keys file has been updated.  Full information in the link:


Upgrading a VMware 6.0 ESXi host fails with the error: Cannot run upgrade script on host

I had a problem in that updates were not successful on the cluster.  Many reports for the error message “Upgrading a VMware ESXi host fails with the error: Cannot run upgrade script on host” point to removing the FDM installation using the uninstall.sh


However I didn’t have the uninstallers directory on my ESX boxes. My solution was to enable HA on the cluster then removed HA on the cluster and after that updates worked fine.