Skip to content

Commit ebf11fa

Browse files
committed
Avoid sending path across the wire for local resource file name
Fixes #669
1 parent f3e6ab2 commit ebf11fa

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

juju/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ async def add_local_resources(self, application, entity_url, metadata, resources
18581858
'description': '',
18591859
'fingerprint': '',
18601860
'name': name,
1861-
'path': path,
1861+
'path': Path(path).name,
18621862
'revision': 0,
18631863
'size': 0,
18641864
'type_': resource_type,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
applications:
2+
file-resource-charm:
3+
charm: ./file-resource-charm
4+
num_units: 1
5+
resources:
6+
file-res: ./file-resource-charm/test.file

tests/integration/test_model.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
MB = 1
2424
GB = 1024
2525
SSH_KEY = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsYMJGNGG74HAJha3n2CFmWYsOOaORnJK6VqNy86pj0MIpvRXBzFzVy09uPQ66GOQhTEoJHEqE77VMui7+62AcMXT+GG7cFHcnU8XVQsGM6UirCcNyWNysfiEMoAdZScJf/GvoY87tMEszhZIUV37z8PUBx6twIqMdr31W1J0IaPa+sV6FEDadeLaNTvancDcHK1zuKsL39jzAg7+LYjKJfEfrsQP+lj/EQcjtKqlhVS5kzsJVfx8ZEd0xhW5G7N6bCdKNalS8mKCMaBXJpijNQ82AiyqCIDCRrre2To0/i7pTjRiL0U9f9mV3S4NJaQaokR050w/ZLySFf6F7joJT mathijs@Qrama-Mathijs' # noqa
26-
HERE_DIR = Path(__file__).absolute().parent
27-
TESTS_DIR = HERE_DIR.parent
26+
HERE_DIR = Path(__file__).absolute().parent # tests/integration
27+
TESTS_DIR = HERE_DIR.parent # tests/
2828
OVERLAYS_DIR = HERE_DIR / 'bundle' / 'test-overlays'
2929

3030

@@ -61,6 +61,20 @@ async def test_deploy_local_bundle_file(event_loop):
6161
timeout=60 * 4)
6262

6363

64+
@base.bootstrapped
65+
@pytest.mark.asyncio
66+
async def test_deploy_bundle_local_resource_relative_path(event_loop):
67+
bundle_file_path = HERE_DIR / 'bundle-file-resource.yaml'
68+
69+
async with base.CleanModel() as model:
70+
await model.deploy(str(bundle_file_path))
71+
72+
app = model.applications.get('file-resource-charm')
73+
assert app
74+
await model.block_until(lambda: (len(app.units) == 1),
75+
timeout=60 * 4)
76+
77+
6478
@base.bootstrapped
6579
@pytest.mark.asyncio
6680
async def test_deploy_local_bundle_include_file(event_loop):

0 commit comments

Comments
 (0)