Create a new function for both sections of code needing to output
remainder stream bytes into output file. This makes error handling simpler
and easier to focus on the errors here in tencent.
I've adapted the code to use the OCI model of outputting the needed
data since OCI code written by William handles the output slightly
different based on previous experiences with OCI and I think this may
just help the Tencent case as well.
Also change some types to reduce casting. All in all this slightly
cleans up the code a bit.
We do not want to break anything where HTTP/1.0 is only supported,
so we advertise 1.1 but allow responses from 1.0 capable server
as well as 1.1 capable servers.
Instead of keep duplicating existing code, we can make this program
a little bit more versatile and cover all 3 use cases and add some
extensibility for further additions.
A static table describes what needs fetching and from where. The
rest is logically the same and so the delta isn't so bad.
We add tencent cloud support on top of this.
Other cloud-config implementations like cloud-init resizes automatically the
rootfs to the maximum allowed, ucd should do the same.
fixes#34
Signed-off-by: Julio Montes <julio.montes@intel.com>
On some of the computational AWS instances, the HTTP service at
169.254* does not support HTTP/1.0 keep-alive. This causes the
second part of the user-data not to be transferred and results
in an error during the execution of ucd-aws. Subsequently, the
SSH key never gets provisioned by `ucd`. The result is an unusable
AWS instance that can't be remotely logged into.
Instead, we just terminate and reconnect for the second HTTP
request, reusing some memory where we can. This is a minute
bit slower, and doesn't really come at a size penalty either,
since it's just the same functions being used.
Since we have another task also run `usermod` as well, these
might bump into a lock file for /etc/ files and fail, leaving
the system unable to login a normal user.
This adds support for parsing openstack meta-data.json files in
config-2 filesystems and extracting and installing any SSH pubkeys
into the default user account.
In order to properly parse a config-2 json blob outside of the normal
openstack early initialization, we need to fill the parser table
properly and clean it up.
This exposes some flaws in other parts of this code that appear that
this wasn't entirely fully tested. I have not yet confirmed that
in a config-2 scenario everything actually automatically works yet,
this remains to be done.
The ucd-aws program fetches the user-data for an AMI instance
over http from 169.254.169.254, and passes it back to ucd.
The service is not supposed to be enabled unless you are running
on AWS, as it is highly specific to that cloud.
Prior to this change, a NULL pw_dir would result in pwd_buf being leaked after
write_ssh_keys is called. Granted, it's a minor leak, and only potential, but
should still be fixed regardless.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>