andrewchilds/overcast

Running `overcast instance import` with a name but no IP wipes out `clusters.json`

garnold opened this issue · 2 comments

Steps to reproduce (output below):

  1. Run overcast instance import to populate clusters.json. Also note that Overcast reports "Cluster sux-pi-3 has been created", however the cluster name is actually "sux-pis".
  2. Run overcast info to verify that the instance has been added to clusters.json.
  3. Run overcast instance import again, this time providing a name but no IP.
  4. Run overcast info to see that clusters.json is corrupt (the file is now empty).
overcast garnold$ ./bin/overcast instance import sux-pi-3 10.0.1.5 --cluster sux-pis --user pi
Cluster "sux-pi-3" has been created.
Instance "sux-pi-3" (10.0.1.5) has been imported to the "sux-pis" cluster.

overcast garnold$ ./bin/overcast info
Using /Users/garnold/.overcast/clusters.json

sux-pis

  sux-pi-3
    ip: 10.0.1.5
    name: sux-pi-3
    ssh_port: 22
    ssh_key: overcast.key
    user: pi

overcast garnold$ ./bin/overcast instance import whoops
Using "default" cluster.
Missing [ip] argument.

Usage:
  overcast instance import [name] [ip] [options...]

Description:
  Imports an existing instance to a cluster.

Options:                 Defaults:
  --cluster CLUSTER      default
  --ssh-port PORT        22
  --ssh-key PATH         overcast.key
  --user USERNAME        root
  --password PASSWORD    

Examples:
  $ overcast instance import app.01 127.0.0.1 --cluster app \
      --ssh-port 22222 --ssh-key $HOME/.ssh/id_rsa

overcast garnold$ ./bin/overcast info
Unable to parse the clusters.json file. Please correct the parsing error.

Good catch @garnold - this is fixed in 0.6.8.

Awesome!