common.py: allow specifying number of attempts in exec_cmd