StratusLab / client

Command Line Interface (CLI) for StratusLab cloud services
Apache License 2.0
2 stars 1 forks source link

stratus-create-image should accept relative names for scripts #24

Closed loomis closed 11 years ago

loomis commented 11 years ago

The stratus-create-image command incorrectly looks for scripts with a relative path at the root of the file system. The command should be modified to check the existence of the script and to fail before starting the image creation process. It should also append the current working directory to relative path names.

An example of the output is:

$ stratus-create-image -s setup-ubuntu.sh -a apache2 \
  HZTKYZgX7XzSokCHMB60lS0wsiv \
  --type m1.xlarge --comment "ubuntu create image test" \
  --author "charles loomis" --author-email "loomis@lal.in2p3.fr" 

 :::::::::::::::::::::::::::::
 :: Starting image creation ::
 :::::::::::::::::::::::::::::
 :: Checking that base image exists
 :: Retrieving image manifest
 :: Starting base image
  [WARNING] Image availability check is disabled.

 :::::::::::::::::::::::::
 :: Starting machine(s) ::
 :::::::::::::::::::::::::
 :: Starting 1 machine
 :: Machine 1 (vm ID: 1568)
    Public ip: 134.158.75.95
 :: Done!
 :: Waiting for machine to boot
................
 :: Waiting for machine network to start
....
 :: Check if we can connect to the machine
 :: Executing user prerecipe
 :: Installing user packages
 :: Executing user recipe
 :: Executing user scripts
 :: Shutting down machine
  [ERROR] An error occurred while uploading script setup-ubuntu.sh
/setup-ubuntu.sh: No such file or directory
loomis commented 11 years ago

See Creator.py around line 451. If the dirname function returns an empty string or non-absolute directory, then the current working directory should be appended.

loomis commented 11 years ago

Probably this line should be changed to use os.path.abspath('my/path') for each script.