Skip to content

Commit 1363bfa

Browse files
author
Juan Tirado
committed
Force error when using old versions.
1 parent bedc855 commit 1363bfa

9 files changed

Lines changed: 48 additions & 49806 deletions

File tree

.github/workflows/test.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,29 @@ name: Testing
33
on: [push, pull_request]
44

55
jobs:
6+
lint:
7+
name: Linter
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python:
12+
- "3.8"
13+
- "3.9"
14+
- "3.10"
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v3
18+
- name: Setup Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ matrix.python }}
22+
- name: Install dependencies
23+
run: pip install tox
24+
- name: Run linter
25+
run: tox -e lint
26+
627
unit-tests:
28+
needs: lint
729
name: Unit tests
830
runs-on: ubuntu-latest
931
strategy:
@@ -24,9 +46,9 @@ jobs:
2446
- name: Run unit tests
2547
run: tox -e py3
2648

27-
2849
integration:
2950
name: Integration
51+
needs: [lint, unit-tests]
3052
timeout-minutes: 120
3153
runs-on: ubuntu-latest
3254
strategy:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.0-beta1
1+
3.1.0-b1

juju/client/connector.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
log = logging.getLogger('connector')
1313

14+
# The SUPPORTED_JUJU_API_PREFIX indicates the prefix of the
15+
# juju version this python-libjuju version supports. For
16+
# example, "3.0." indicates that all the 3.0.x versions
17+
# are intended to be supported.
18+
SUPPORTED_JUJU_API_PREFIX = "3.0."
1419

1520
class NoConnectionException(Exception):
1621
'''Raised by Connector when the connection method is called
@@ -73,6 +78,10 @@ async def connect(self, **kwargs):
7378
await self._connection.close()
7479
self._connection = await Connection.connect(**kwargs)
7580

81+
# Check if we support the target controller
82+
if not self._connection.info['server-version'].startswith(SUPPORTED_JUJU_API_PREFIX):
83+
raise JujuConnectionError("juju server-version %s not supported" % self._connection.info["server-version"])
84+
7685
async def disconnect(self):
7786
"""Shut down the watcher task and close websockets.
7887
"""

0 commit comments

Comments
 (0)