← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~smoser/cloud-init:cleanup/ec2-console-as-bytes into cloud-init:master

 


Diff comments:

> diff --git a/tests/cloud_tests/platforms/ec2/platform.py b/tests/cloud_tests/platforms/ec2/platform.py
> index fdb17ba..ba246fe 100644
> --- a/tests/cloud_tests/platforms/ec2/platform.py
> +++ b/tests/cloud_tests/platforms/ec2/platform.py
> @@ -228,4 +230,28 @@ class EC2Platform(Platform):
>  
>          return self.tag
>  
> +
> +def _decode_console_output_as_bytes(parsed, **kwargs):
> +    """Provide console output as bytes in OutputBytes.
> +
> +       For this to be useful, the session has to have had the
> +       decode_console_output handler unregistered already.
> +
> +       https://github.com/boto/botocore/issues/1351 ."""
> +    if 'Output' not in parsed:
> +        return
> +    orig = parsed['Output']
> +    handlers.decode_console_output(parsed, **kwargs)
> +    parsed['OutputBytes'] = base64.b64decode(orig)
> +
> +
> +def get_ec2_client():
> +    mysess = session.get_session()

Maybe a comment here w.r.t what the unregister/register is achieving (maybe the same ref to the botocore issue from above?

> +    mysess.unregister('after-call.ec2.GetConsoleOutput',
> +                      handlers.decode_console_output)
> +    mysess.register('after-call.ec2.GetConsoleOutput',
> +                    _decode_console_output_as_bytes)
> +    return mysess.create_client('ec2')
> +
> +
>  # vi: ts=4 expandtab


-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/336366
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:cleanup/ec2-console-as-bytes into cloud-init:master.


References