bug #2144: Execute epilog commands if an attach operation fails

(cherry picked from commit f5876a248ec52fe1e06c54754829c5b0fee7bbb1)