From 04c1f3058231e70f8267344cb03bb99cd6ca3654 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 24 Feb 2016 01:38:56 +0100 Subject: [PATCH] Retain order of domains This ensures that the first domain specified on the command line will be the domain that winds up in the CN field. Otherwise, users have no way of controlling this. Fixes: kuba/simp_le#72 Signed-off-by: Jason A. Donenfeld --- setup.py | 1 + simp_le.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3b79f07..6df4f74 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ install_requires.extend([ 'argparse', 'mock<1.1.0', + 'ordereddict', ]) else: install_requires.extend([ diff --git a/simp_le.py b/simp_le.py index 671c702..8b10842 100755 --- a/simp_le.py +++ b/simp_le.py @@ -21,6 +21,10 @@ import abc import argparse import collections +try: + from collections import OrderedDict # pylint: disable=import-error +except ImportError: + from ordereddict import OrderedDict # pylint: disable=import-error import contextlib import datetime import doctest @@ -1270,7 +1274,7 @@ def new_data(args, existing): client = registered_client(args, existing.account_key) - authorizations = dict( + authorizations = OrderedDict( (vhost.name, client.request_domain_challenges( vhost.name, new_authz_uri=client.directory.new_authz)) for vhost in args.vhosts