Fixes bug converning filenames with dots (#33493)
The name detminator was incorrect. This fixes it and fixes unit tests related things that were broken downstream
This commit is contained in:
parent
1f1f1c9d04
commit
212340bf0c
4 changed files with 17 additions and 16 deletions
|
@ -248,11 +248,10 @@ class KeyParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def key_filename(self):
|
def key_filename(self):
|
||||||
fname, fext = os.path.splitext(self.name)
|
if self.name.endswith('.key'):
|
||||||
if fext == '':
|
|
||||||
return fname + '.key'
|
|
||||||
else:
|
|
||||||
return self.name
|
return self.name
|
||||||
|
else:
|
||||||
|
return self.name + '.key'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def key_checksum(self):
|
def key_checksum(self):
|
||||||
|
@ -308,11 +307,10 @@ class CertParameters(Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cert_filename(self):
|
def cert_filename(self):
|
||||||
fname, fext = os.path.splitext(self.name)
|
if self.name.endswith('.crt'):
|
||||||
if fext == '':
|
|
||||||
return fname + '.crt'
|
|
||||||
else:
|
|
||||||
return self.name
|
return self.name
|
||||||
|
else:
|
||||||
|
return self.name + '.crt'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cert_src(self):
|
def cert_src(self):
|
||||||
|
|
|
@ -167,11 +167,10 @@ class Parameters(AnsibleF5Parameters):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def key_filename(self):
|
def key_filename(self):
|
||||||
fname, fext = os.path.splitext(self.name)
|
if self.name.endswith('.key'):
|
||||||
if fext == '':
|
|
||||||
return fname + '.key'
|
|
||||||
else:
|
|
||||||
return self.name
|
return self.name
|
||||||
|
else:
|
||||||
|
return self.name + '.key'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def key_checksum(self):
|
def key_checksum(self):
|
||||||
|
|
|
@ -15,9 +15,9 @@ if sys.version_info < (2, 7):
|
||||||
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
||||||
|
|
||||||
from ansible.compat.tests import unittest
|
from ansible.compat.tests import unittest
|
||||||
from ansible.compat.tests.mock import patch, Mock
|
from ansible.compat.tests.mock import Mock
|
||||||
|
from ansible.compat.tests.mock import patch
|
||||||
from ansible.module_utils.f5_utils import AnsibleF5Client
|
from ansible.module_utils.f5_utils import AnsibleF5Client
|
||||||
from units.modules.utils import set_module_args
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from library.bigip_ssl_certificate import ArgumentSpec
|
from library.bigip_ssl_certificate import ArgumentSpec
|
||||||
|
@ -27,6 +27,7 @@ try:
|
||||||
from library.bigip_ssl_certificate import HAS_F5SDK
|
from library.bigip_ssl_certificate import HAS_F5SDK
|
||||||
from library.bigip_ssl_certificate import KeyManager
|
from library.bigip_ssl_certificate import KeyManager
|
||||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
|
from test.unit.modules.utils import set_module_args
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from ansible.modules.network.f5.bigip_ssl_certificate import ArgumentSpec
|
from ansible.modules.network.f5.bigip_ssl_certificate import ArgumentSpec
|
||||||
|
@ -36,6 +37,7 @@ except ImportError:
|
||||||
from ansible.modules.network.f5.bigip_ssl_certificate import HAS_F5SDK
|
from ansible.modules.network.f5.bigip_ssl_certificate import HAS_F5SDK
|
||||||
from ansible.modules.network.f5.bigip_ssl_certificate import KeyManager
|
from ansible.modules.network.f5.bigip_ssl_certificate import KeyManager
|
||||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
|
from units.modules.utils import set_module_args
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ if sys.version_info < (2, 7):
|
||||||
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
||||||
|
|
||||||
from ansible.compat.tests import unittest
|
from ansible.compat.tests import unittest
|
||||||
from ansible.compat.tests.mock import patch, Mock
|
from ansible.compat.tests.mock import Mock
|
||||||
|
from ansible.compat.tests.mock import patch
|
||||||
from ansible.module_utils.f5_utils import AnsibleF5Client
|
from ansible.module_utils.f5_utils import AnsibleF5Client
|
||||||
from units.modules.utils import set_module_args
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from library.bigip_ssl_key import ArgumentSpec
|
from library.bigip_ssl_key import ArgumentSpec
|
||||||
|
@ -25,6 +25,7 @@ try:
|
||||||
from library.bigip_ssl_key import ModuleManager
|
from library.bigip_ssl_key import ModuleManager
|
||||||
from library.bigip_ssl_key import HAS_F5SDK
|
from library.bigip_ssl_key import HAS_F5SDK
|
||||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
|
from test.unit.modules.utils import set_module_args
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from ansible.modules.network.f5.bigip_ssl_key import ArgumentSpec
|
from ansible.modules.network.f5.bigip_ssl_key import ArgumentSpec
|
||||||
|
@ -32,6 +33,7 @@ except ImportError:
|
||||||
from ansible.modules.network.f5.bigip_ssl_key import ModuleManager
|
from ansible.modules.network.f5.bigip_ssl_key import ModuleManager
|
||||||
from ansible.modules.network.f5.bigip_ssl_key import HAS_F5SDK
|
from ansible.modules.network.f5.bigip_ssl_key import HAS_F5SDK
|
||||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
|
from units.modules.utils import set_module_args
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue