Comment 6 for bug 1884071

Revision history for this message
Scott Moser (smoser) wrote :

Well, this does make cloud-config-archive support gzipped blobs, so in one way it fixes an issue that was reported. But the problem really seems to be that:

a.) Hetzner only supports (utf8?) strings in their user-data
b.) "terraform modules for templating cloud init hard depend base64 encoding on enabling gzip compression:"

Another option is just to add transparent decompression on the user-data blob that we get from hetzner. The problem with transparent decompression is you can't turn it off...

That change would look like this:

--- a/cloudinit/sources/DataSourceHetzner.py
+++ b/cloudinit/sources/DataSourceHetzner.py
@@ -59,7 +59,13 @@ class DataSourceHetzner(sources.DataSource):
                 self.userdata_address, timeout=self.timeout,
                 sec_between=self.wait_retry, retries=self.retries)

- self.userdata_raw = ud
+ # Hetzner cloud does not support binary user-data. So try to
+ # transparently compress what we download. The issue with
+ # doing this is that now /var/lib/cloud-init/cloud-config.txt
+ # woudl have *uncompressed* content in it. A user that was
+ # rightfully expecting it to have exactly the user-data they
+ # provided to Hetzner would be broken.
+ self.userdata_raw = util.decomp_gzip(ud, quiet=True, decode=False)
         self.metadata_full = md

         """hostname is name provided by user at launch. The API enforces