forked from pool/python-softlayer
- Add fix-maint-issue.patch (fixes bsc#1203311).
- No, we actually don't need python-six at all. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-softlayer?expand=0&rev=31
This commit is contained in:
192
fix-maint-issue.patch
Normal file
192
fix-maint-issue.patch
Normal file
@@ -0,0 +1,192 @@
|
||||
From 392c38718c172a8f76c1f53fbe23ba2659cf320c Mon Sep 17 00:00:00 2001
|
||||
From: Christopher Gallo <chrisagallo@gmail.com>
|
||||
Date: Fri, 23 Sep 2022 13:31:01 -0500
|
||||
Subject: [PATCH 1/4] updated release workflow for the correct url
|
||||
|
||||
---
|
||||
.github/workflows/release.yml | 2
|
||||
SoftLayer/CLI/cdn/detail.py | 2
|
||||
SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping.py | 6 +-
|
||||
SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Metrics.py | 6 +-
|
||||
tests/CLI/modules/cdn_tests.py | 29 ++++------
|
||||
tests/managers/cdn_tests.py | 19 +++++-
|
||||
6 files changed, 37 insertions(+), 27 deletions(-)
|
||||
|
||||
--- a/.github/workflows/release.yml
|
||||
+++ b/.github/workflows/release.yml
|
||||
@@ -48,5 +48,5 @@ jobs:
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.CGALLO_PYPI }}
|
||||
- repository_url: https://pypi.org/legacy/
|
||||
+ repository_url: https://upload.pypi.org/legacy/
|
||||
|
||||
--- a/SoftLayer/CLI/cdn/detail.py
|
||||
+++ b/SoftLayer/CLI/cdn/detail.py
|
||||
@@ -41,6 +41,6 @@ def cli(env, unique_id, history):
|
||||
table.add_row(['status', cdn_mapping['status']])
|
||||
table.add_row(['total_bandwidth', total_bandwidth])
|
||||
table.add_row(['total_hits', total_hits])
|
||||
- table.add_row(['hit_radio', hit_ratio])
|
||||
+ table.add_row(['hit_ratio', hit_ratio])
|
||||
|
||||
env.fout(table)
|
||||
--- a/SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping.py
|
||||
+++ b/SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping.py
|
||||
@@ -11,7 +11,7 @@ listDomainMappings = [
|
||||
"path": "/",
|
||||
"protocol": "HTTP",
|
||||
"status": "CNAME_CONFIGURATION",
|
||||
- "uniqueId": "9934111111111",
|
||||
+ "uniqueId": "11223344",
|
||||
"vendorName": "akamai"
|
||||
}
|
||||
]
|
||||
@@ -28,7 +28,7 @@ listDomainMappingByUniqueId = [
|
||||
"path": "/",
|
||||
"protocol": "HTTP",
|
||||
"status": "CNAME_CONFIGURATION",
|
||||
- "uniqueId": "9934111111111",
|
||||
+ "uniqueId": "11223344",
|
||||
"vendorName": "akamai"
|
||||
}
|
||||
]
|
||||
@@ -41,7 +41,7 @@ updateDomainMapping = [
|
||||
"performanceConfiguration": "Large file optimization",
|
||||
"protocol": "HTTP",
|
||||
"respectHeaders": True,
|
||||
- "uniqueId": "424406419091111",
|
||||
+ "uniqueId": "11223344",
|
||||
"vendorName": "akamai",
|
||||
"header": "www.test.com",
|
||||
"httpPort": 83,
|
||||
--- a/SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Metrics.py
|
||||
+++ b/SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Metrics.py
|
||||
@@ -6,9 +6,9 @@ getMappingUsageMetrics = [
|
||||
"HitRatio"
|
||||
],
|
||||
"totals": [
|
||||
- "0.0",
|
||||
- "0",
|
||||
- "0.0"
|
||||
+ 1.0,
|
||||
+ 3,
|
||||
+ 2.0
|
||||
],
|
||||
"type": "TOTALS"
|
||||
}
|
||||
--- a/tests/CLI/modules/cdn_tests.py
|
||||
+++ b/tests/CLI/modules/cdn_tests.py
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
:license: MIT, see LICENSE for more details.
|
||||
"""
|
||||
+import datetime
|
||||
import json
|
||||
+from unittest import mock as mock
|
||||
|
||||
from SoftLayer.CLI import exceptions
|
||||
from SoftLayer import testing
|
||||
@@ -21,27 +23,22 @@ class CdnTests(testing.TestCase):
|
||||
'domain': 'test.example.com',
|
||||
'origin': '1.1.1.1',
|
||||
'status': 'CNAME_CONFIGURATION',
|
||||
- 'unique_id': '9934111111111',
|
||||
+ 'unique_id': '11223344',
|
||||
'vendor': 'akamai'}]
|
||||
)
|
||||
|
||||
- def test_detail_account(self):
|
||||
+ @mock.patch('SoftLayer.utils.days_to_datetime')
|
||||
+ def test_detail_account(self, mock_now):
|
||||
+ mock_now.return_value = datetime.datetime(2020, 1, 1)
|
||||
result = self.run_command(['cdn', 'detail', '--history=30', '1245'])
|
||||
|
||||
self.assert_no_fail(result)
|
||||
- self.assertEqual(json.loads(result.output),
|
||||
- {'hit_radio': '0.0 %',
|
||||
- 'hostname': 'test.example.com',
|
||||
- 'origin': '1.1.1.1',
|
||||
- 'origin_type': 'HOST_SERVER',
|
||||
- 'path': '/',
|
||||
- 'protocol': 'HTTP',
|
||||
- 'provider': 'akamai',
|
||||
- 'status': 'CNAME_CONFIGURATION',
|
||||
- 'total_bandwidth': '0.0 GB',
|
||||
- 'total_hits': '0',
|
||||
- 'unique_id': '9934111111111'}
|
||||
- )
|
||||
+ api_results = json.loads(result.output)
|
||||
+ self.assertEqual(api_results['hit_ratio'], '2.0 %')
|
||||
+ self.assertEqual(api_results['total_bandwidth'], '1.0 GB')
|
||||
+ self.assertEqual(api_results['total_hits'], 3)
|
||||
+ self.assertEqual(api_results['hostname'], 'test.example.com')
|
||||
+ self.assertEqual(api_results['protocol'], 'HTTP')
|
||||
|
||||
def test_purge_content(self):
|
||||
result = self.run_command(['cdn', 'purge', '1234',
|
||||
@@ -122,7 +119,7 @@ class CdnTests(testing.TestCase):
|
||||
self.assertEqual('include: test', header_result['Cache key optimization'])
|
||||
|
||||
def test_edit_cache_by_uniqueId(self):
|
||||
- result = self.run_command(['cdn', 'edit', '9934111111111', '--cache', 'include-specified', '--cache', 'test'])
|
||||
+ result = self.run_command(['cdn', 'edit', '11223344', '--cache', 'include-specified', '--cache', 'test'])
|
||||
self.assert_no_fail(result)
|
||||
header_result = json.loads(result.output)
|
||||
self.assertEqual('include: test', header_result['Cache key optimization'])
|
||||
--- a/tests/managers/cdn_tests.py
|
||||
+++ b/tests/managers/cdn_tests.py
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
:license: MIT, see LICENSE for more details.
|
||||
"""
|
||||
+import datetime
|
||||
+from unittest import mock as mock
|
||||
|
||||
from SoftLayer import fixtures
|
||||
from SoftLayer.managers import cdn
|
||||
@@ -28,7 +30,9 @@ class CDNTests(testing.TestCase):
|
||||
'listDomainMappingByUniqueId',
|
||||
args=args)
|
||||
|
||||
- def test_detail_usage_metric(self):
|
||||
+ @mock.patch('SoftLayer.utils.days_to_datetime')
|
||||
+ def test_detail_usage_metric(self, mock_now):
|
||||
+ mock_now.return_value = datetime.datetime(2020, 1, 1)
|
||||
self.cdn_client.get_usage_metrics(12345, history=30, frequency="aggregate")
|
||||
|
||||
args = (12345,
|
||||
@@ -39,6 +43,15 @@ class CDNTests(testing.TestCase):
|
||||
'getMappingUsageMetrics',
|
||||
args=args)
|
||||
|
||||
+ # Does this still work in 2038 ? https://github.com/softlayer/softlayer-python/issues/1764 for context
|
||||
+ @mock.patch('SoftLayer.utils.days_to_datetime')
|
||||
+ def test_detail_usage_metric_future(self, mock_now):
|
||||
+ mock_now.return_value = datetime.datetime(2040, 1, 1)
|
||||
+ self.assertRaises(
|
||||
+ OverflowError,
|
||||
+ self.cdn_client.get_usage_metrics, 12345, history=30, frequency="aggregate"
|
||||
+ )
|
||||
+
|
||||
def test_get_origins(self):
|
||||
self.cdn_client.get_origins("12345")
|
||||
self.assert_called_with('SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path',
|
||||
@@ -105,7 +118,7 @@ class CDNTests(testing.TestCase):
|
||||
args=args)
|
||||
|
||||
def test_cdn_edit(self):
|
||||
- identifier = '9934111111111'
|
||||
+ identifier = '11223344'
|
||||
header = 'www.test.com'
|
||||
result = self.cdn_client.edit(identifier, header=header)
|
||||
|
||||
@@ -116,7 +129,7 @@ class CDNTests(testing.TestCase):
|
||||
'SoftLayer_Network_CdnMarketplace_Configuration_Mapping',
|
||||
'updateDomainMapping',
|
||||
args=({
|
||||
- 'uniqueId': '9934111111111',
|
||||
+ 'uniqueId': '11223344',
|
||||
'originType': 'HOST_SERVER',
|
||||
'protocol': 'HTTP',
|
||||
'path': '/',
|
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 17 18:04:18 UTC 2022 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add fix-maint-issue.patch (fixes bsc#1203311).
|
||||
- No, we actually don't need python-six at all.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 6 06:15:44 UTC 2022 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define skip_python2 1
|
||||
Name: python-softlayer
|
||||
Version: 6.1.2
|
||||
@@ -25,6 +24,9 @@ Summary: A set of Python libraries that assist in calling the SoftLayer A
|
||||
License: MIT
|
||||
URL: https://github.com/softlayer/softlayer-python
|
||||
Source: https://github.com/softlayer/softlayer-python/archive/v%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM fix-maint-issue.patch bsc#1203311 mcepl@suse.com
|
||||
# xmlrpc y2038 problem
|
||||
Patch0: fix-maint-issue.patch
|
||||
BuildRequires: %{python_module click >= 8.0.4}
|
||||
BuildRequires: %{python_module prettytable >= 2.5.0}
|
||||
BuildRequires: %{python_module prompt_toolkit >= 2}
|
||||
@@ -33,7 +35,6 @@ BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module requests >= 2.20.0}
|
||||
BuildRequires: %{python_module rich >= 12.5.1}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module six >= 1.7.0}
|
||||
BuildRequires: %{python_module softlayer-zeep >= 5.0.0}
|
||||
BuildRequires: %{python_module testtools}
|
||||
BuildRequires: %{python_module typing_extensions}
|
||||
@@ -47,7 +48,6 @@ Requires: python-pygments >= 2.0.0
|
||||
Requires: python-requests >= 2.20.0
|
||||
Requires: python-rich >= 12.5.1
|
||||
Requires: python-setuptools
|
||||
Requires: python-six >= 1.7.0
|
||||
Requires: python-softlayer-zeep >= 5.0.0
|
||||
Requires: python-typing_extensions
|
||||
Requires: python-urllib3 >= 1.24
|
||||
@@ -60,7 +60,7 @@ Requires(postun):update-alternatives
|
||||
This library provides a simple Python client to interact with SoftLayer's XML-RPC API.
|
||||
|
||||
%prep
|
||||
%setup -q -n softlayer-python-%{version}
|
||||
%autosetup -p1 -n softlayer-python-%{version}
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
Reference in New Issue
Block a user