alex/letsencrypt-aws

"ValueError: need more than 0 values to unpack" error

bshih-ixxus opened this issue · 0 comments

I have come across the above error : "ValueError: need more than 0 values to unpack". It turned out that I had put double quotes around the value for "port:" in LETSENCRYPT_AWS_CONFIG, as per instruction :-)

$ export LETSENCRYPT_AWS_CONFIG='{"domains":[{"elb":{"name":"my-elb","port":"443"},"hosts":["my_host.com"],"key_type":"rsa"}],"acme_account_key":"file:///home/ec2-user/my-le-folder/letsencrypt_priv.pem"}'
$ python letsencrypt-aws.py update-certificates
2016-03-16 14:27:40 [startup] 
2016-03-16 14:27:41 [running] mode='single'
2016-03-16 14:27:41 [updating-elb] elb_name=u'my_elb'
Traceback (most recent call last):
  File "letsencrypt-aws.py", line 526, in <module>
    cli()
  File "/home/ec2-user/my-le-folder/le-aws/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ec2-user/my-le-folder/le-aws/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ec2-user/my-le-folder/le-aws/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ec2-user/my-le-folder/le-aws/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ec2-user/my-le-folder/le-aws/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "letsencrypt-aws.py", line 489, in update_certificates
    force_issue, certificate_requests
  File "letsencrypt-aws.py", line 387, in update_elbs
    cert_request,
  File "letsencrypt-aws.py", line 319, in update_elb
    expiration_date = cert_request.cert_location.get_expiration_date()
  File "letsencrypt-aws.py", line 72, in get_expiration_date
    if listener["Listener"]["LoadBalancerPort"] == self.elb_port
ValueError: need more than 0 values to unpack

This converted the value of port to unicode rather than int. By removing the double quotes, it worked just fine.

$ export LETSENCRYPT_AWS_CONFIG='{"domains":[{"elb":{"name":"my_elb","port":443},"hosts":["my_host.com"],"key_type":"rsa"}],"acme_account_key":"file:///home/ec2-user/my-le-folder/letsencrypt_priv.pem"}'
$ python letsencrypt-aws.py update-certificates
2016-03-16 14:30:38 [startup] 
2016-03-16 14:30:38 [running] mode='single'
2016-03-16 14:30:38 [updating-elb] elb_name=u'my_elb'
2016-03-16 14:30:39 [updating-elb.certificate-expiration] expiration_date=datetime.date(2016, 6, 14) elb_name=u'my_elb'

IMHO, it should either work (via some casting/checking within letsencrypt-aws.py) or have a better error message.