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

flockerctl unusable #73

Closed lmeyemezu closed 7 years ago

lmeyemezu commented 7 years ago

Hi, I'm trying to use flockerctl as described in https://flocker-docs.clusterhq.com/en/latest/flocker-features/flockerctl.html Message error is below

/usr/local/bin/flockerctl: 3: read: Illegal option -d
Unhandled Error
Traceback (most recent call last):
  File "/opt/flocker/bin/flockerctl", line 9, in <module>
    load_entry_point('UnofficialFlockerTools==0.6', 'console_scripts', 'flockerctl')()
  File "/opt/flocker/local/lib/python2.7/site-packages/unofficial_flocker_tools/flocker_volumes.py", line 381, in _main
    react(main, sys.argv[1:])
  File "/opt/flocker/local/lib/python2.7/site-packages/twisted/internet/task.py", line 882, in react
    finished = main(_reactor, *argv)
  File "/opt/flocker/local/lib/python2.7/site-packages/unofficial_flocker_tools/flocker_volumes.py", line 361, in main
    d = defer.maybeDeferred(base.subOptions.run)
--- <exception caught here> ---
  File "/opt/flocker/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/opt/flocker/local/lib/python2.7/site-packages/unofficial_flocker_tools/flocker_volumes.py", line 96, in run
    self.client = get_client(self.parent)
  File "/opt/flocker/local/lib/python2.7/site-packages/unofficial_flocker_tools/flocker_volumes.py", line 57, in get_client
    target_hostname=control_service,
  File "/opt/flocker/local/lib/python2.7/site-packages/unofficial_flocker_tools/txflocker/client.py", line 172, in get_client
    user_crt, cluster_crt, user_key, target_hostname))
exceptions.Exception: Not enough information to construct TLS context: user_crt: FilePath('/pwd/user.crt'), cluster_crt: FilePath('/pwd/cluster.crt'), user_key: FilePath('/pwd/user.key'), target_hostname: 192.168.106.7

main function encountered error
Traceback (most recent call last):
  File "/opt/flocker/local/lib/python2.7/site-packages/twisted/internet/task.py", line 882, in react
    finished = main(_reactor, *argv)
  File "/opt/flocker/local/lib/python2.7/site-packages/unofficial_flocker_tools/flocker_volumes.py", line 372, in main
    d.addErrback(err)
  File "/opt/flocker/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 328, in addErrback
    errbackKeywords=kw)
  File "/opt/flocker/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 306, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/opt/flocker/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/opt/flocker/local/lib/python2.7/site-packages/unofficial_flocker_tools/flocker_volumes.py", line 371, in err
    reactor.stop()
  File "/opt/flocker/local/lib/python2.7/site-packages/twisted/internet/base.py", line 581, in stop
    "Can't stop reactor that isn't running.")
twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.

I'm using docker swarm mode Version: 1.12.3

Any idea ?

wallrj commented 7 years ago

Hey @lmeyemezu

Thanks for the bug report.

The first error message /usr/local/bin/flockerctl: 3: read: Illegal option -d can be ignored. The script uses read -d which is a bash specific extension, but the script interpreter is #!/bin/sh which on Ubuntu is dash shell. I've created a Jira issue for this problem:

The next error seems to be because you're not pointing flockerctl at your Flocker certificates directory.

Here's how I run flockerctl:

flockerctl --control-service $FLOCKER_CONTROL_NODE  --certs-path $FLOCKER_API_CERTIFICATES_PATH list 

Where FLOCKER_API_CERTIFICATES_PATH=/etc/flocker (or a directory where you ran flocker-ca to generate the certificates.)

We should make the error message clearer though.

wallrj commented 7 years ago

@lmeyemezu I put a branch up for review which fixes the read -d warning. Let me know if that works for you.

Also beware of another known issue with flockerctl in a docker-swarm environment.

lmeyemezu commented 7 years ago

Hi @wallrj , thanks for replying. you're right ; flocker-api-certificates was wrong. Regards