ClusterHQ / unofficial-flocker-tools

A tool to make installing Flocker with container orchestration tools easier and more fun
https://clusterhq.com/
11 stars 9 forks source link

uft should check tfvars if pem/key actually exists #44

Open wallnerryan opened 8 years ago

wallnerryan commented 8 years ago

You can get to the point where you can provision nodes and terraform uses path but it doesnt have to exists.

wallnerryan@mac:-> uft-flocker-get-nodes --ubuntu-aws
aws_vpc.cluster_vpc: Creating...
  .
  .
  .
  vars.operating_system:      "" => "ubuntu"
  vars.private_key_path:      "" => "/Users/wallnerryan/Desktop/ClusterHQ-Dev/aws-ecs-dev/ryan.pem"
template_file.cluster_yml: Provisioning with 'local-exec'...
template_file.cluster_yml (local-exec): Executing: /bin/sh -c "echo 'cluster_name: cluster
template_file.cluster_yml (local-exec): agent_nodes:
template_file.cluster_yml (local-exec):  - {public: 54.175.221.253, private: 10.0.151.193}
template_file.cluster_yml (local-exec):  - {public: 54.88.211.173, private: 10.0.246.121}
template_file.cluster_yml (local-exec):  - {public: 52.91.69.49, private: 10.0.212.211}
template_file.cluster_yml (local-exec): # TODO make this use a floating IP
template_file.cluster_yml (local-exec): control_node: ec2-54-175-221-62.compute-1.amazonaws.com
template_file.cluster_yml (local-exec): users:
template_file.cluster_yml (local-exec):  - user
template_file.cluster_yml (local-exec): os: ubuntu
template_file.cluster_yml (local-exec): private_key_path: /Users/wallnerryan/Desktop/ClusterHQ-Dev/aws-ecs-dev/ryan.pem
  .
  .
  .
template_file.cluster_yml: Creation complete

Apply complete! Resources: 11 added, 0 changed, 0 destroyed.

The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.

State path: terraform.tfstate
wallnerryan@mac:-> uft-flocker-install cluster.yml && uft-flocker-config cluster.yml && uft-flocker-plugin-install cluster.yml
main function encountered error
Traceback (most recent call last):
  File "/opt/flocker/bin/flocker-install", line 9, in <module>
    load_entry_point('UnofficialFlockerTools==0.5', 'console_scripts', 'flocker-install')()
  File "/opt/flocker/lib/python2.7/site-packages/unofficial_flocker_tools/install.py", line 152, in _main
    react(main, sys.argv[1:])
  File "/opt/flocker/lib/python2.7/site-packages/twisted/internet/task.py", line 875, in react
    finished = main(_reactor, *argv)
  File "/opt/flocker/lib/python2.7/site-packages/twisted/internet/defer.py", line 1253, in unwindGenerator
    return _inlineCallbacks(None, gen, Deferred())
--- <exception caught here> ---
  File "/opt/flocker/lib/python2.7/site-packages/twisted/internet/defer.py", line 1107, in _inlineCallbacks
    result = g.send(result)
  File "/opt/flocker/lib/python2.7/site-packages/unofficial_flocker_tools/install.py", line 30, in main
    (c.get_user_facing_key_path(),))
unofficial_flocker_tools.install.UsageError: Private key specified in private_key_path in config does not exist at: /Users/wallnerryan/Desktop/ClusterHQ-Dev/aws-ecs-dev/ryan.pem

Resulting in the need to manually change this in cluster.yml after it is produced. Not a big deal but if we could do a sanity check it would eliminate the need for the user knowing how to parse the error.

Stephenitis commented 8 years ago

+1 on added an earlier sanity check. (i'm currently attempting to run the test successfully before making some changes to the library)

lukemarsden commented 8 years ago

PRs welcome ;)