Fix broken path to shell scripts

This was broken when extensions/ subdirectory was created.
Also add test to ensure this doesn't break again.

Change-Id: I12524a927397c3d2a90d00198873e2e1b4786171
This commit is contained in:
Jim Rollenhagen 2014-04-29 14:55:45 -07:00
parent f95c8a9e6d
commit ea652bced0
2 changed files with 5 additions and 1 deletions
ironic_python_agent
extensions
tests/extensions

@ -40,7 +40,7 @@ def _image_location(image_info):
def _path_to_script(script):
cwd = os.path.dirname(os.path.realpath(__file__))
return os.path.join(cwd, script)
return os.path.join(cwd, '..', script)
def _write_image(image_info, device):

@ -347,3 +347,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
execute_mock.assert_called_once_with(*command)
self.assertEqual('FAILED', failed_result.command_status)
def test_path_to_script(self):
script = standby._path_to_script('shell/reboot.sh')
self.assertTrue(script.endswith('extensions/../shell/reboot.sh'))