From 61c59b730f06e2b04c79f993e1eef7ee0d7beb8f Mon Sep 17 00:00:00 2001 From: aviau Date: Fri, 3 Jul 2015 09:10:13 -0400 Subject: [PATCH] New default port: 5311 Change-Id: I74a7fd4e8b808350f5b153ca8cd8dd85cade0827 --- README.rst | 8 ++++---- surveilclient/shell.py | 2 +- surveilclient/tests/common/test_http.py | 2 +- surveilclient/tests/test_client.py | 10 +++++----- surveilclient/tests/v2_0/actions/test_acknowledge.py | 2 +- surveilclient/tests/v2_0/actions/test_downtime.py | 2 +- surveilclient/tests/v2_0/actions/test_recheck.py | 2 +- surveilclient/tests/v2_0/clienttest.py | 4 ++-- .../tests/v2_0/config/test_checkmodulations.py | 6 +++--- surveilclient/tests/v2_0/config/test_commands.py | 10 +++++----- surveilclient/tests/v2_0/config/test_hosts.py | 10 +++++----- surveilclient/tests/v2_0/config/test_services.py | 6 +++--- surveilclient/tests/v2_0/status/test_events.py | 4 ++-- surveilclient/tests/v2_0/status/test_hosts.py | 6 +++--- surveilclient/tests/v2_0/status/test_metrics.py | 10 +++++----- surveilclient/tests/v2_0/status/test_services.py | 4 ++-- 16 files changed, 44 insertions(+), 44 deletions(-) diff --git a/README.rst b/README.rst index aa5c4fb..b1371b3 100644 --- a/README.rst +++ b/README.rst @@ -13,8 +13,8 @@ You'll need to provide the Surveil API URL. You can do this with the ``--surveil-api-url`` parameter, but it's easier to just set it as environment variable:: - export SURVEIL_API_URL=http://localhost:8080/v2 - export SURVEIL_AUTH_URL=http://localhost:8080/v2/auth + export SURVEIL_API_URL=http://localhost:5311/v2 + export SURVEIL_AUTH_URL=http://localhost:5311/v2/auth You'll find complete documentation on the shell by running ``surveil help``. @@ -31,8 +31,8 @@ Python API To use the python API, simply create a client with the endpoint:: from surveilclient import client - c = client.Client('http://localhost:8080/v2', - auth_url='http://localhost:8080/v2/auth', + c = client.Client('http://localhost:5311/v2', + auth_url='http://localhost:5311/v2/auth', version='2_0') hosts = c.config.hosts.list() diff --git a/surveilclient/shell.py b/surveilclient/shell.py index 21825bc..79aa221 100644 --- a/surveilclient/shell.py +++ b/surveilclient/shell.py @@ -49,7 +49,7 @@ class SurveilShell(object): parser.add_argument('--surveil-api-url', default=utils.env( 'SURVEIL_API_URL', - default='http://localhost:8080/v2'), + default='http://localhost:5311/v2'), help='Defaults to env[SURVEIL_API_URL].') parser.add_argument('--surveil-api-version', diff --git a/surveilclient/tests/common/test_http.py b/surveilclient/tests/common/test_http.py index 507ecd2..7c4bfbf 100644 --- a/surveilclient/tests/common/test_http.py +++ b/surveilclient/tests/common/test_http.py @@ -23,7 +23,7 @@ from surveilclient.common import http class TestHttp(unittest.TestCase): def setUp(self): - self.surveil_url = 'http://surveil:8080/v1' + self.surveil_url = 'http://surveil:5311/v1' self.client = http.HTTPClient(self.surveil_url, authenticated=False) @httpretty.activate diff --git a/surveilclient/tests/test_client.py b/surveilclient/tests/test_client.py index 36daaad..f242fe5 100644 --- a/surveilclient/tests/test_client.py +++ b/surveilclient/tests/test_client.py @@ -22,16 +22,16 @@ from surveilclient.v2_0 import client as v2_0_client class TestClient(unittest.TestCase): def test_client_default_version(self): - sc = client.Client('http://localhost:8080/sdf', - auth_url='http://localhost:8080/v2/auth') + sc = client.Client('http://localhost:5311/sdf', + auth_url='http://localhost:5311/v2/auth') self.assertTrue(isinstance(sc, v2_0_client.Client)) def test_client_init_v1(self): - sc = client.Client('http://localhost:8080/v1', version='1_0') + sc = client.Client('http://localhost:5311/v1', version='1_0') self.assertTrue(isinstance(sc, v1_0_client.Client)) def test_client_init_v2(self): - sc = client.Client('http://localhost:8080/v2', - auth_url='http://localhost:8080/v2/auth', + sc = client.Client('http://localhost:5311/v2', + auth_url='http://localhost:5311/v2/auth', version='2_0') self.assertTrue(isinstance(sc, v2_0_client.Client)) diff --git a/surveilclient/tests/v2_0/actions/test_acknowledge.py b/surveilclient/tests/v2_0/actions/test_acknowledge.py index 555e1c5..f44116d 100644 --- a/surveilclient/tests/v2_0/actions/test_acknowledge.py +++ b/surveilclient/tests/v2_0/actions/test_acknowledge.py @@ -22,7 +22,7 @@ class TestAcknowledge(clienttest.ClientTest): @httpretty.activate def test_create(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/actions/acknowledge", + httpretty.POST, "http://localhost:5311/v2/actions/acknowledge", body='{"message": "Ack received!"}') self.client.actions.acknowledge.create( diff --git a/surveilclient/tests/v2_0/actions/test_downtime.py b/surveilclient/tests/v2_0/actions/test_downtime.py index cd7fa9c..e7c1a15 100644 --- a/surveilclient/tests/v2_0/actions/test_downtime.py +++ b/surveilclient/tests/v2_0/actions/test_downtime.py @@ -22,7 +22,7 @@ class TestDowntime(clienttest.ClientTest): @httpretty.activate def test_create(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/actions/downtime", + httpretty.POST, "http://localhost:5311/v2/actions/downtime", body='{"message": "Ack received!"}') self.client.actions.downtime.create( diff --git a/surveilclient/tests/v2_0/actions/test_recheck.py b/surveilclient/tests/v2_0/actions/test_recheck.py index fb83908..d0cc919 100644 --- a/surveilclient/tests/v2_0/actions/test_recheck.py +++ b/surveilclient/tests/v2_0/actions/test_recheck.py @@ -23,7 +23,7 @@ class TestRecheck(clienttest.ClientTest): @httpretty.activate def test_create(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/actions/recheck", + httpretty.POST, "http://localhost:5311/v2/actions/recheck", body='{"message": "Ack received!"}') self.client.actions.recheck.create( diff --git a/surveilclient/tests/v2_0/clienttest.py b/surveilclient/tests/v2_0/clienttest.py index c945af6..4e48dae 100644 --- a/surveilclient/tests/v2_0/clienttest.py +++ b/surveilclient/tests/v2_0/clienttest.py @@ -22,8 +22,8 @@ from surveilclient import client class ClientTest(unittest.TestCase): def setUp(self): - self.client = client.Client('http://localhost:8080/v2', - auth_url='http://localhost:8080/v2/auth', + self.client = client.Client('http://localhost:5311/v2', + auth_url='http://localhost:5311/v2/auth', version='2_0') # Mock the _get_auth_token call diff --git a/surveilclient/tests/v2_0/config/test_checkmodulations.py b/surveilclient/tests/v2_0/config/test_checkmodulations.py index 422eb60..1fc3dd3 100644 --- a/surveilclient/tests/v2_0/config/test_checkmodulations.py +++ b/surveilclient/tests/v2_0/config/test_checkmodulations.py @@ -22,7 +22,7 @@ class TestCheckModulations(clienttest.ClientTest): @httpretty.activate def test_create(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/config/checkmodulations", + httpretty.POST, "http://localhost:5311/v2/config/checkmodulations", body='{"message": "Ack received!"}') self.client.config.checkmodulations.create( @@ -41,7 +41,7 @@ class TestCheckModulations(clienttest.ClientTest): @httpretty.activate def test_list(self): httpretty.register_uri( - httpretty.GET, "http://localhost:8080/v2/config/checkmodulations", + httpretty.GET, "http://localhost:5311/v2/config/checkmodulations", body='[{"checkmodulation_name": "test","check_command": "test",' '"check_period": "test"}]' ) @@ -55,7 +55,7 @@ class TestCheckModulations(clienttest.ClientTest): @httpretty.activate def test_delete(self): httpretty.register_uri( - httpretty.DELETE, "http://localhost:8080/v2/config/" + httpretty.DELETE, "http://localhost:5311/v2/config/" "checkmodulations/checkmodulation_to_delete", body='body') diff --git a/surveilclient/tests/v2_0/config/test_commands.py b/surveilclient/tests/v2_0/config/test_commands.py index 8dec797..4d694a9 100644 --- a/surveilclient/tests/v2_0/config/test_commands.py +++ b/surveilclient/tests/v2_0/config/test_commands.py @@ -25,7 +25,7 @@ class TestCommands(clienttest.ClientTest): def test_list(self): httpretty.register_uri( httpretty.GET, - "http://localhost:8080/v2/config/commands", + "http://localhost:5311/v2/config/commands", body='[{"command_name":"myCommand"}]' ) @@ -37,7 +37,7 @@ class TestCommands(clienttest.ClientTest): @httpretty.activate def test_create(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/config/commands", + httpretty.POST, "http://localhost:5311/v2/config/commands", body='{"command_name": "new_command", "command_line": "new_line"}' ) @@ -58,7 +58,7 @@ class TestCommands(clienttest.ClientTest): def test_show(self): httpretty.register_uri( httpretty.GET, - "http://localhost:8080/v2/config/commands/command_to_show", + "http://localhost:5311/v2/config/commands/command_to_show", body='{"command_name": "command_to_show", "command_line": "line"}' ) @@ -78,7 +78,7 @@ class TestCommands(clienttest.ClientTest): def test_update(self): httpretty.register_uri( httpretty.PUT, - "http://localhost:8080/v2/config/commands/command_to_update", + "http://localhost:5311/v2/config/commands/command_to_update", body='{"command_line": "updated command_line"}' ) @@ -99,7 +99,7 @@ class TestCommands(clienttest.ClientTest): def test_delete(self): httpretty.register_uri( httpretty.DELETE, - "http://localhost:8080/v2/config/commands/command_to_delete", + "http://localhost:5311/v2/config/commands/command_to_delete", body="body" ) diff --git a/surveilclient/tests/v2_0/config/test_hosts.py b/surveilclient/tests/v2_0/config/test_hosts.py index f007a3e..f7f50c4 100644 --- a/surveilclient/tests/v2_0/config/test_hosts.py +++ b/surveilclient/tests/v2_0/config/test_hosts.py @@ -24,7 +24,7 @@ class TestHosts(clienttest.ClientTest): @httpretty.activate def test_list(self): httpretty.register_uri( - httpretty.GET, "http://localhost:8080/v2/config/hosts", + httpretty.GET, "http://localhost:5311/v2/config/hosts", body='[{"host_name": "host1"}]' ) @@ -38,7 +38,7 @@ class TestHosts(clienttest.ClientTest): @httpretty.activate def test_create(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/config/hosts", + httpretty.POST, "http://localhost:5311/v2/config/hosts", body='{"host_name": "new_host", "address": "192.168.2.1"}' ) @@ -59,7 +59,7 @@ class TestHosts(clienttest.ClientTest): def test_show(self): httpretty.register_uri( httpretty.GET, - "http://localhost:8080/v2/config/hosts/host_name_to_show", + "http://localhost:5311/v2/config/hosts/host_name_to_show", body='{"host_name": "host_name_to_show"}' ) @@ -76,7 +76,7 @@ class TestHosts(clienttest.ClientTest): def test_update(self): httpretty.register_uri( httpretty.PUT, - "http://localhost:8080/v2/config/hosts/host_name_to_update", + "http://localhost:5311/v2/config/hosts/host_name_to_update", body='{"test": "test"}' ) @@ -99,7 +99,7 @@ class TestHosts(clienttest.ClientTest): def test_delete(self): httpretty.register_uri( httpretty.DELETE, - "http://localhost:8080/v2/config/hosts/host_name_to_delete", + "http://localhost:5311/v2/config/hosts/host_name_to_delete", body="body" ) diff --git a/surveilclient/tests/v2_0/config/test_services.py b/surveilclient/tests/v2_0/config/test_services.py index 2854e35..6c60730 100644 --- a/surveilclient/tests/v2_0/config/test_services.py +++ b/surveilclient/tests/v2_0/config/test_services.py @@ -22,7 +22,7 @@ class TestServices(clienttest.ClientTest): @httpretty.activate def test_list(self): httpretty.register_uri( - httpretty.GET, "http://localhost:8080/v2/config/services", + httpretty.GET, "http://localhost:5311/v2/config/services", body='[{"service_name": "service1"}]' ) @@ -36,7 +36,7 @@ class TestServices(clienttest.ClientTest): @httpretty.activate def test_create(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/config/services", + httpretty.POST, "http://localhost:5311/v2/config/services", body='{"service_name": "new_service"}' ) @@ -53,7 +53,7 @@ class TestServices(clienttest.ClientTest): def test_delete(self): httpretty.register_uri( httpretty.DELETE, - "http://localhost:8080/v2/config/hosts/host_name/" + + "http://localhost:5311/v2/config/hosts/host_name/" + "services/service_description", body="body" ) diff --git a/surveilclient/tests/v2_0/status/test_events.py b/surveilclient/tests/v2_0/status/test_events.py index 6b42621..4f54fdd 100644 --- a/surveilclient/tests/v2_0/status/test_events.py +++ b/surveilclient/tests/v2_0/status/test_events.py @@ -23,7 +23,7 @@ class TestEvents(clienttest.ClientTest): @httpretty.activate def test_list(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/status/events", + httpretty.POST, "http://localhost:5311/v2/status/events", body='[{"host_name": "sfl.com", "service_description": "cpu", ' '"event_type": "ALERT", "output": "Ok"},' '{"host_name": "sfl.com", "service_description": "cpu", ' @@ -53,7 +53,7 @@ class TestEvents(clienttest.ClientTest): @httpretty.activate def test_list_with_live_query(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/status/events", + httpretty.POST, "http://localhost:5311/v2/status/events", body='[{"host_name": "sfl.com", "service_description": "cpu", ' '"event_type": "ALERT", "output": "Ok"},' '{"host_name": "sfl.com", "service_description": "cpu", ' diff --git a/surveilclient/tests/v2_0/status/test_hosts.py b/surveilclient/tests/v2_0/status/test_hosts.py index 107a112..a42fe21 100644 --- a/surveilclient/tests/v2_0/status/test_hosts.py +++ b/surveilclient/tests/v2_0/status/test_hosts.py @@ -24,7 +24,7 @@ class TestHosts(clienttest.ClientTest): @httpretty.activate def test_list(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/status/hosts", + httpretty.POST, "http://localhost:5311/v2/status/hosts", body='[{"host_name": "host1"}]' ) @@ -38,7 +38,7 @@ class TestHosts(clienttest.ClientTest): @httpretty.activate def test_get(self): httpretty.register_uri( - httpretty.GET, "http://localhost:8080/v2/status/hosts/hostname", + httpretty.GET, "http://localhost:5311/v2/status/hosts/hostname", body='{"host_name": "host1"}' ) @@ -52,7 +52,7 @@ class TestHosts(clienttest.ClientTest): @httpretty.activate def test_submit_host_check_result(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/status/hosts/localhost" + httpretty.POST, "http://localhost:5311/v2/status/hosts/localhost" "/results", body='' ) diff --git a/surveilclient/tests/v2_0/status/test_metrics.py b/surveilclient/tests/v2_0/status/test_metrics.py index 96b1259..d0374be 100644 --- a/surveilclient/tests/v2_0/status/test_metrics.py +++ b/surveilclient/tests/v2_0/status/test_metrics.py @@ -22,7 +22,7 @@ class TestMetrics(clienttest.ClientTest): @httpretty.activate def test_list_metrics(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/status/" + httpretty.POST, "http://localhost:5311/v2/status/" "hosts/localhost/metrics/load1", body='[{"min": "2", "warning": "15", "value": "3"},' '{"min": "5", "warning": "200", "value": "150"}]' @@ -43,7 +43,7 @@ class TestMetrics(clienttest.ClientTest): @httpretty.activate def test_list_service(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/status/hosts/localhost" + httpretty.POST, "http://localhost:5311/v2/status/hosts/localhost" "/services/load/metrics/load1", body='[{"min": "2", "warning": "15", "value": "3"},' '{"min": "5", "warning": "200", "value": "150"}]' @@ -64,7 +64,7 @@ class TestMetrics(clienttest.ClientTest): @httpretty.activate def test_show(self): httpretty.register_uri( - httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost" + httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost" "/metrics/load1", body='{"min": "2", "warning": "15", "value": "3"}' ) @@ -79,7 +79,7 @@ class TestMetrics(clienttest.ClientTest): @httpretty.activate def test_show_service(self): httpretty.register_uri( - httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost" + httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost" "/services/load/metrics/load1", body='{"min": "2", "warning": "15", "value": "3"}' ) @@ -95,7 +95,7 @@ class TestMetrics(clienttest.ClientTest): @httpretty.activate def test_list_metrics_name(self): httpretty.register_uri( - httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost" + httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost" "/metrics", body='[{"metric_name": "rta"},{"metric_name": "load5"}]' ) diff --git a/surveilclient/tests/v2_0/status/test_services.py b/surveilclient/tests/v2_0/status/test_services.py index cb99735..7d97e56 100644 --- a/surveilclient/tests/v2_0/status/test_services.py +++ b/surveilclient/tests/v2_0/status/test_services.py @@ -24,7 +24,7 @@ class TestServices(clienttest.ClientTest): @httpretty.activate def test_list(self): httpretty.register_uri( - httpretty.POST, "http://localhost:8080/v2/status/services", + httpretty.POST, "http://localhost:5311/v2/status/services", body='[{"service_name": "service1"}]' ) @@ -39,7 +39,7 @@ class TestServices(clienttest.ClientTest): def test_submit_service_check_result(self): httpretty.register_uri( httpretty.POST, - "http://localhost:8080/v2/status/hosts/localhost" + "http://localhost:5311/v2/status/hosts/localhost" "/services/testservice/results", body='' )