Skip to content

Commit 25b3074

Browse files
satterlynsa-softpayclaude
authored
Fix missing id parameters and broken method calls in API client (#399)
* Fix missing id parameters and broken method calls in API client - Add missing `id` parameter to get_customer(), get_key(), get_perm(), and get_group() which would raise NameError at runtime - Fix update_me_attributes() where `data` was passed to string formatting operator instead of as argument to http.put() - Remove dead Python 2 compatibility check from __init__.py Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix CI integration tests by migrating to docker compose v2 The standalone `docker-compose` (v1) binary is no longer installed on GitHub Actions ubuntu-latest runners. Use the `docker compose` plugin subcommand instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Nick Satterly <nsa@softpay.io> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d4e3706 commit 25b3074

3 files changed

Lines changed: 8 additions & 34 deletions

File tree

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ jobs:
4747
- name: Integration Test
4848
id: integration-test
4949
run: |
50-
docker-compose -f docker-compose.ci.yaml build sut
51-
docker-compose -f docker-compose.ci.yaml up --exit-code-from sut
52-
docker-compose -f docker-compose.ci.yaml rm --stop --force
50+
docker compose -f docker-compose.ci.yaml build sut
51+
docker compose -f docker-compose.ci.yaml up --exit-code-from sut
52+
docker compose -f docker-compose.ci.yaml rm --stop --force
5353
- uses: act10ns/slack@v2
5454
with:
5555
status: ${{ job.status }}

alertaclient/__init__.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +0,0 @@
1-
import sys
2-
3-
if sys.version_info < (3,):
4-
raise ImportError(
5-
"""You are running Alerta 6.0 on Python 2
6-
7-
Alerta 6.0 and above are no longer compatible with Python 2.
8-
9-
Make sure you have pip >= 9.0 to avoid this kind of issue,
10-
as well as setuptools >= 24.2:
11-
12-
$ pip install pip setuptools --upgrade
13-
14-
Your choices:
15-
16-
- Upgrade to Python 3.
17-
18-
- Install an older version of Alerta:
19-
20-
$ pip install 'alerta<6.0'
21-
22-
See the following URL for more up-to-date information:
23-
24-
https://github.com/alerta/alerta/wiki/Python-3
25-
26-
""")

alertaclient/api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def create_customer(self, customer, match):
223223
r = self.http.post('/customer', data)
224224
return Customer.parse(r['customer'])
225225

226-
def get_customer(self):
226+
def get_customer(self, id):
227227
return Customer.parse(self.http.get('/customer/%s' % id)['customer'])
228228

229229
def get_customers(self, query=None):
@@ -278,7 +278,7 @@ def create_key(self, username, scopes=None, expires=None, text='', customer=None
278278
r = self.http.post('/key', data)
279279
return ApiKey.parse(r['data'])
280280

281-
def get_key(self):
281+
def get_key(self, id):
282282
return ApiKey.parse(self.http.get('/key/%s' % id)['key'])
283283

284284
def get_keys(self, query=None):
@@ -307,7 +307,7 @@ def create_perm(self, role, scopes=None):
307307
r = self.http.post('/perm', data)
308308
return Permission.parse(r['permission'])
309309

310-
def get_perm(self):
310+
def get_perm(self, id):
311311
return Permission.parse(self.http.get('/perm/%s' % id)['perm'])
312312

313313
def get_perms(self, query=None):
@@ -408,7 +408,7 @@ def update_me_attributes(self, attributes):
408408
data = {
409409
'attributes': attributes
410410
}
411-
return self.http.put('/user/me/attributes' % data)
411+
return self.http.put('/user/me/attributes', data)
412412

413413
def delete_user(self, id):
414414
return self.http.delete('/user/%s' % id)
@@ -448,7 +448,7 @@ def create_group(self, name, text):
448448
r = self.http.post('/group', data)
449449
return Group.parse(r['group'])
450450

451-
def get_group(self):
451+
def get_group(self, id):
452452
return Group.parse(self.http.get('/group/%s' % id)['group'])
453453

454454
def get_group_users(self, id):

0 commit comments

Comments
 (0)