Skip to content

Commit d448cf3

Browse files
Merge pull request #1563 from allmightyspiff/issues1561
Fix errors with `vs bandwidth`
2 parents 30dc977 + 90631f8 commit d448cf3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

SoftLayer/CLI/virt/bandwidth.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ def cli(env, identifier, start_date, end_date, summary_period, quite_summary):
3636
"""
3737
vsi = SoftLayer.VSManager(env.client)
3838
vsi_id = helpers.resolve_id(vsi.resolve_ids, identifier, 'VS')
39-
data = vsi.get_bandwidth_data(vsi_id, start_date, end_date, None, summary_period)
39+
40+
# Summary period is broken for virtual guests, check VIRT-11733 for a resolution.
41+
# For now, we are going to ignore summary_period and set it to the default the API imposes
42+
if summary_period != 300:
43+
click.secho("""The Summary Period option is currently set to the 300s as the backend API will throw an exception
44+
any other value. This should be resolved in the next version of the slcli.""", fg='yellow')
45+
summary_period = 300
46+
data = vsi.get_bandwidth_data(vsi_id, start_date, end_date, None, None)
4047

4148
title = "Bandwidth Report: %s - %s" % (start_date, end_date)
4249
table, sum_table = create_bandwidth_table(data, summary_period, title)

tests/CLI/modules/vs/vs_tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ def test_usage_metric_data_empty(self):
761761
self.assertIsInstance(result.exception, exceptions.CLIAbort)
762762

763763
def test_bandwidth_vs(self):
764+
self.skipTest("Skipping until VIRT-11733 is released")
764765
if sys.version_info < (3, 6):
765766
self.skipTest("Test requires python 3.6+")
766767

@@ -789,6 +790,7 @@ def test_bandwidth_vs(self):
789790
self.assertEqual(output_list[0]['Pub In'], 1.3503)
790791

791792
def test_bandwidth_vs_quite(self):
793+
self.skipTest("Skipping until VIRT-11733 is released")
792794
result = self.run_command(['vs', 'bandwidth', '100', '--start_date=2019-01-01', '--end_date=2019-02-01', '-q'])
793795
self.assert_no_fail(result)
794796

0 commit comments

Comments
 (0)