← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~tlashchova/cloud-init:fix-bug-add-unittest into cloud-init:master

 

improve your commit message, just have a 'messag'e part as well as subject.

Ie:
   Do not write invalid keys to authorized_keys

   This fixes a bug where invalid keys would sneak into authorized_keys.


Diff comments:

> diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py
> index b95b956..e0bcdb8 100644
> --- a/cloudinit/ssh_util.py
> +++ b/cloudinit/ssh_util.py
> @@ -172,14 +172,16 @@ def parse_authorized_keys(fname):
>  
>  def update_authorized_keys(old_entries, keys):
>      to_add = list(keys)
> -
> +    print to_add

drop the 'print'

>      for i in range(0, len(old_entries)):
>          ent = old_entries[i]
>          if not ent.valid():
>              continue
>          # Replace those with the same base64
>          for k in keys:
> -            if not ent.valid():
> +            if not k.valid():
> +                if k in to_add:
> +                    to_add.remove(k)
>                  continue
>              if k.base64 == ent.base64:
>                  # Replace it with our better one


-- 
https://code.launchpad.net/~tlashchova/cloud-init/+git/cloud-init/+merge/337003
Your team cloud-init commiters is requested to review the proposed merge of ~tlashchova/cloud-init:fix-bug-add-unittest into cloud-init:master.


Follow ups

References