Skip to content

Fixed UnboundLocalError

Krisztián Löki requested to merge fixed-UnboundLocalError into master

There was an UnboundLocalError in one of the jobs: https://gitlab.esss.lu.se/ccce/ans/ics-ans-role-lab-ioc-deploy/-/jobs/228766

        # Kill procServ
        with host.sudo():
            host.run(f"kill {pid}")

        # Check that kill was successful
        try:
            host.process.get(pid=pid)
        except RuntimeError as e:
            msg = str(e)

>       assert msg == "No process found"
E       UnboundLocalError: local variable 'msg' referenced before assignment

Fixed that by adding a sleep between killing and checking the result and by initializing msg

Merge request reports