Skip to content

Commit

Permalink
- Fixed bug in formatting name attributes.
Browse files Browse the repository at this point in the history
- Pushed up 2.0.3.
  • Loading branch information
Tyler Spens committed Sep 26, 2022
1 parent e3d908f commit 99f3a48
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pytpp/_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
__author_email__ = '[email protected]'
__project_name__ = 'pytpp'
__project_url__ = 'https://github.com/Venafi/pytpp'
__version__ = '2.0.2'
__version__ = '2.0.3'
2 changes: 1 addition & 1 deletion pytpp/features/bases/feature_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def _name_value_list(attributes: Dict[str, List[str]]):
if v is None:
continue
if not isinstance(v, (list, tuple, set)):
v = [str(v)]
v = str(v)
else:
v = list(map(str, v))
nvl.append(config.NameAttribute(name=n, value=v))
Expand Down
1 change: 1 addition & 0 deletions pytpp/features/certificate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from datetime import datetime

from pytpp.api.api_base import InvalidResponseError
from pytpp.attributes.x509_certificate import X509CertificateAttributes
from pytpp.features.bases.feature_base import FeatureBase, feature
Expand Down
21 changes: 5 additions & 16 deletions pytpp/features/certificate_authorities.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def create(self, name: str, parent_folder: 'Union[config.Object, str]', hostname
Returns:
:ref:`config_object` of the certificate authority.
"""
bool_to_string = lambda x: {True: "1", False: "0"}.get(x)
ca_attrs = {
MicrosoftCAAttributes.driver_name : 'camicrosoft',
MicrosoftCAAttributes.host : hostname,
Expand All @@ -79,22 +80,10 @@ def create(self, name: str, parent_folder: 'Union[config.Object, str]', hostname
MicrosoftCAAttributes.template : template,
MicrosoftCAAttributes.description : description,
MicrosoftCAAttributes.contact : [self._get_prefixed_universal(c) for c in contacts] if contacts else None,
MicrosoftCAAttributes.manual_approval : {
True : "1",
False: "0"
}.get(manual_approvals),
MicrosoftCAAttributes.san_enabled : {
True : "1",
False: "1"
}.get(subject_alt_name_enabled),
MicrosoftCAAttributes.include_cn_as_san : {
True : "1",
False: "0"
}.get(automatically_include_cn_as_dns_san),
MicrosoftCAAttributes.specific_end_date_enabled : {
True : "1",
False: "0"
}.get(allow_users_to_specify_end_date),
MicrosoftCAAttributes.manual_approval : bool_to_string(manual_approvals),
MicrosoftCAAttributes.san_enabled : bool_to_string(subject_alt_name_enabled),
MicrosoftCAAttributes.include_cn_as_san : bool_to_string(automatically_include_cn_as_dns_san),
MicrosoftCAAttributes.specific_end_date_enabled : bool_to_string(allow_users_to_specify_end_date),
MicrosoftCAAttributes.enrollment_agent_certificate: self._get_dn(enrollment_agent) if enrollment_agent else None
}
if attributes:
Expand Down
Empty file removed pytpp/tools/helpers/__init__.py
Empty file.

0 comments on commit 99f3a48

Please sign in to comment.