Skip to content

Commit 3d6866b

Browse files
committed
Fix file resource charm raise on error
1 parent cec424f commit 3d6866b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

juju/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2752,10 +2752,10 @@ def _raise_for_status(entities, status):
27522752
# errors to raise at the end
27532753
break
27542754
for unit in app.units:
2755-
if unit.machine is not None and unit.machine.status == "error":
2755+
if raise_on_error and unit.machine is not None and unit.machine.status == "error":
27562756
errors.setdefault("Machine", []).append(unit.machine.id)
27572757
continue
2758-
if unit.agent_status == "error":
2758+
if raise_on_error and unit.agent_status == "error":
27592759
errors.setdefault("Agent", []).append(unit.name)
27602760
continue
27612761
if raise_on_error and unit.workload_status == "error":

tests/integration/test_application.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
logger = logging.getLogger(__name__)
1616

17+
from ..utils import INTEGRATION_TEST_DIR
1718

1819
@base.bootstrapped
1920
async def test_action(event_loop):
@@ -191,17 +192,16 @@ async def test_upgrade_local_charm(event_loop):
191192
@base.bootstrapped
192193
async def test_upgrade_local_charm_resource(event_loop):
193194
async with base.CleanModel() as model:
194-
tests_dir = Path(__file__).absolute().parent
195-
charm_path = tests_dir / 'file-resource-charm'
195+
charm_path = INTEGRATION_TEST_DIR / 'file-resource-charm'
196196
resources = {"file-res": "test.file"}
197197

198198
app = await model.deploy(str(charm_path), resources=resources)
199199
assert 'file-resource-charm' in model.applications
200-
await model.wait_for_idle()
200+
await model.wait_for_idle(raise_on_error=False)
201201
assert app.units[0].agent_status == 'idle'
202202

203203
await app.upgrade_charm(path=charm_path, resources=resources)
204-
await model.wait_for_idle()
204+
await model.wait_for_idle(raise_on_error=False)
205205
ress = await app.get_resources()
206206
assert 'file-res' in ress
207207
assert ress['file-res']

0 commit comments

Comments
 (0)