Skip to content

Commit fa0e3ad

Browse files
authored
Remove locations (#290)
Also fix all dependabot alerts AB#10634 Signed-off-by: Paul Hewlett <[email protected]>
1 parent 79fdaf5 commit fa0e3ad

40 files changed

+174
-1917
lines changed

archivist/archivist.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
The REST methods in this class should only be used directly when
99
a CRUD endpoint for the specific type of entity is unavailable.
10-
Current CRUD endpoints are assets, events, locations, attachments.
10+
Current CRUD endpoints are assets, events, attachments.
1111
IAM subjects and IAM access policies.
1212
1313
Instantiation of this class encapsulates the URL and authentication
@@ -25,7 +25,7 @@
2525
max_time=300.0,
2626
)
2727
28-
The arch variable now has additional endpoints assets,events,locations,
28+
The arch variable now has additional endpoints assets,events,
2929
attachments, IAM subjects and IAM access policies documented elsewhere.
3030
3131
"""
@@ -62,7 +62,6 @@
6262
_parse_response,
6363
)
6464
from .events import _EventsRestricted
65-
from .locations import _LocationsClient
6665
from .retry429 import retry_429
6766
from .runner import _Runner
6867
from .subjects import _SubjectsClient
@@ -96,7 +95,6 @@ class Archivist(ArchivistPublic): # pylint: disable=too-many-instance-attribute
9695
"attachments": _AttachmentsClient,
9796
"composite": _CompositeClient,
9897
"events": _EventsRestricted,
99-
"locations": _LocationsClient,
10098
"runner": _Runner,
10199
"subjects": _SubjectsClient,
102100
"tenancies": _TenanciesClient,
@@ -142,7 +140,6 @@ def __init__(
142140
self.attachments: _AttachmentsClient
143141
self.composite: _CompositeClient
144142
self.events: _EventsRestricted
145-
self.locations: _LocationsClient
146143
self.runner: _Runner
147144
self.subjects: _SubjectsClient
148145
self.tenancies: _TenanciesClient

archivist/assets.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def create_if_not_exists(
168168
self, data: "dict[str, Any]", *, confirm: bool = False
169169
) -> "tuple[Asset, bool]":
170170
"""
171-
Creates an asset and associated locations and attachments if asset
171+
Creates an asset and associated attachments if asset
172172
does not already exist.
173173
174174
Args:
@@ -190,18 +190,6 @@ def create_if_not_exists(
190190
arc_serial_number: das-j1-01
191191
arc_description: Electronic door entry system to DataTrails France
192192
wavestone_asset_id: paris.france.datatrails.das
193-
location:
194-
identity: locations/xxxxxxxxxxxxxxxxxxxxxxxxxx
195-
location:
196-
selector:
197-
- display_name
198-
display_name: DataTrails Paris
199-
description: Sales and sales support for the French region
200-
latitude: 48.8339211,
201-
longitude: 2.371345,
202-
attributes:
203-
address: 5 Parvis Alan Turing, 75013 Paris, France
204-
wavestone_ext: managed
205193
attachments:
206194
- filename: functests/test_resources/doors/assets/entry-terminal.jpg
207195
content_type: image/jpg
@@ -210,12 +198,6 @@ def create_if_not_exists(
210198
The 'selector' value is required and will usually specify the 'arc_display_name' as a
211199
secondary key. The keys in 'selector' must exist in the attributes of the asset.
212200
213-
If 'location' is specified then the 'selector' value is required and is used as a
214-
secondary key. Likewise the secondary key must exist in the attributes of the location.
215-
216-
Alternatively the identity of the location is specified - both
217-
are shown - choose one.
218-
219201
Returns:
220202
tuple of :class:`Asset` instance, Boolean is True if asset already existed
221203
@@ -225,7 +207,6 @@ def create_if_not_exists(
225207
existed = False
226208
data = deepcopy(data)
227209
attachments = data.pop("attachments", None)
228-
location = data.pop("location", None)
229210
selector = data.pop("selector") # must exist
230211
props, attrs = selector_signature(selector, data)
231212
try:
@@ -240,16 +221,6 @@ def create_if_not_exists(
240221
LOGGER.info("asset with selector %s,%s already exists", props, attrs)
241222
return asset, True
242223

243-
# is location present?
244-
if location is not None:
245-
if "identity" in location:
246-
data["attributes"]["arc_home_location_identity"] = location["identity"]
247-
else:
248-
loc, _ = self._archivist.locations.create_if_not_exists(
249-
location,
250-
)
251-
data["attributes"]["arc_home_location_identity"] = loc["identity"]
252-
253224
# any attachments ?
254225
if attachments is not None:
255226
for a in attachments:

archivist/composite.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,9 @@ def estate_info(self):
5858
"""
5959
num_events = self._archivist.events.count()
6060
num_assets = self._archivist.assets.count()
61-
num_locations = self._archivist.locations.count()
6261

6362
LOGGER.info(
64-
(
65-
"There are %s events registered against %s assets"
66-
" in the system spread over %s locations."
67-
),
63+
"There are %s events registered against %s assets in the system",
6864
num_events,
6965
num_assets,
70-
num_locations,
7166
)

archivist/constants.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
ACCESS_POLICIES_SUBPATH = "iam/v1"
5757
ACCESS_POLICIES_LABEL = "access_policies"
5858

59-
LOCATIONS_SUBPATH = "v2"
60-
LOCATIONS_LABEL = "locations"
61-
6259
SBOM_PACKAGE = "Software Package"
6360
SBOM_RELEASE = "Software Package Release"
6461

archivist/events.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -342,17 +342,6 @@ def create_from_data(
342342
data = deepcopy(data)
343343

344344
event_attributes = data["event_attributes"]
345-
# is location present?
346-
location = data.pop("location", None)
347-
if location is not None:
348-
if "identity" in location:
349-
data["event_attributes"]["arc_location_identity"] = location["identity"]
350-
else:
351-
loc, _ = self._archivist.locations.create_if_not_exists(
352-
location,
353-
)
354-
event_attributes["arc_location_identity"] = loc["identity"]
355-
356345
attachments = data.pop("attachments", None)
357346
if attachments is not None:
358347
for a in attachments:

0 commit comments

Comments
 (0)