linuxserver / docker-diskover

A Docker container for the Diskover space mapping application
GNU General Public License v3.0
72 stars 16 forks source link

Export DISKOVER_ARRAY for cleanup.sh #24

Closed itsthejb closed 5 years ago

itsthejb commented 5 years ago

Hi,

I get the following Redis errors from the dispatch script:

+ cd /app/diskover
+ /bin/bash -x /app/cleanup.sh
+ echo 'killing existing workers...'
killing existing workers...
+ '[' -f /tmp/diskover_bot_pids ']'
+ /bin/bash /app/diskover/diskover-bot-launcher.sh -k
+ sleep 3
+ echo 'emptying current redis queues...'
emptying current redis queues...
+ rq empty -u redis://: diskover_crawl diskover diskover_calcdir failed
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 493, in connect
    sock = self._connect()
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 550, in _connect
    raise err
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 538, in _connect
    sock.connect(socket_address)
OSError: [Errno 101] Network unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/redis/client.py", line 754, in execute_command
    connection.send_command(*args)
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 619, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 594, in send_packed_command
    self.connect()
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 498, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 101 connecting to None:6379. Network unreachable.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 493, in connect
    sock = self._connect()
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 550, in _connect
    raise err
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 538, in _connect
    sock.connect(socket_address)
OSError: [Errno 101] Network unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/rq", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/rq/cli/cli.py", line 76, in wrapper
    return ctx.invoke(func, cli_config, *args[1:], **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/rq/cli/cli.py", line 109, in empty
    num_jobs = queue.empty()
  File "/usr/lib/python3.6/site-packages/rq/queue.py", line 117, in empty
    return script(keys=[self.key])
  File "/usr/lib/python3.6/site-packages/redis/client.py", line 3498, in __call__
    return client.evalsha(self.sha, len(keys), *args)
  File "/usr/lib/python3.6/site-packages/redis/client.py", line 2704, in evalsha
    return self.execute_command('EVALSHA', sha, numkeys, *keys_and_args)
  File "/usr/lib/python3.6/site-packages/redis/client.py", line 760, in execute_command
    connection.send_command(*args)
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 619, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 594, in send_packed_command
    self.connect()
  File "/usr/lib/python3.6/site-packages/redis/connection.py", line 498, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 101 connecting to None:6379. Network unreachable.

This seems to be because DISKOVER_ARRAY is not exported so that it can be read from the child cleanup.sh script. From https://stackoverflow.com/questions/5564418/exporting-an-array-in-bash-script, it appears to be possible to do this with the following change, and all works.

Looking forward to your feedback

Thanks

LinuxServer-CI commented 5 years ago

I am a bot, here are the test results for this PR: https://lsio-ci.ams3.digitaloceanspaces.com/lspipepr/diskover/v1.5.0-rc30-pkg-945756dd-pr-24/index.html https://lsio-ci.ams3.digitaloceanspaces.com/lspipepr/diskover/v1.5.0-rc30-pkg-945756dd-pr-24/shellcheck-result.xml

thelamer commented 5 years ago

@itsthejb thanks for the report, we actually can use all env variables in scripts using the header I just committed when this builds can you do me a favor and test the output and confirm functionality on your end?

LinuxServer-CI commented 5 years ago

I am a bot, here are the test results for this PR: https://lsio-ci.ams3.digitaloceanspaces.com/lspipepr/diskover/v1.5.0.2-pkg-a673d62c-pr-24/index.html https://lsio-ci.ams3.digitaloceanspaces.com/lspipepr/diskover/v1.5.0.2-pkg-a673d62c-pr-24/shellcheck-result.xml

thelamer commented 5 years ago

@itsthejb Heads up still waiting for confirmation on your end. The specific Tag for this PR is lspipepr/diskover:v1.5.0.2-pkg-a673d62c-pr-24

Please let us know if you need help swapping out with this tag.

itsthejb commented 5 years ago

@thelamer Very sorry for being so slow to look into this! I can confirm that the tag lspipepr/diskover:v1.5.0.2-pkg-a673d62c-pr-24 works as expected, without needing to mount my hacked script. Thanks for looking into this