Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named cabot-check-network #2

Open
nmarshall-cst opened this issue Oct 24, 2017 · 6 comments
Open

ImportError: No module named cabot-check-network #2

nmarshall-cst opened this issue Oct 24, 2017 · 6 comments

Comments

@nmarshall-cst
Copy link

I am using the docker image for Cabot and I am interested in extending some of the functionality with the cabot-check-network plugin. Is there documentation on how I can accomplish this? I have added this plugin to the $CABOT_PLUGINS_ENABLED envar, but I am receiving the error below. I have tried creating my own docker image where I RUN pip install --no-cache-dir --disable-pip-version-check https://github.com/cabotapp/cabot-check-network/archive/master.zip , but this didn't help. This may be my lack of python/django knowledge. I have searched all of the documentation and issues in the Cabot project, but falling short on how I should be enabling additional plugins. Thanks in advance!!

CABOT_PLUGINS_ENABLED: 'cabot_alert_hipchat,cabot_alert_twilio,cabot_alert_email,cabot_alert_slack,cabot-check-network'

 cabot-webgui 2017-10-24T21:37:11.795825563Z Traceback (most recent call last):
 cabot-webgui 2017-10-24T21:37:11.795894476Z   File "/usr/local/bin/cabot", line 11, in <module>
 cabot-webgui 2017-10-24T21:37:11.795899967Z     sys.exit(main())
 cabot-webgui 2017-10-24T21:37:11.795902432Z   File "/usr/local/lib/python2.7/site-packages/cabot/entrypoint.py", line 10, in main
 cabot-webgui 2017-10-24T21:37:11.79590608Z     execute_from_command_line(sys.argv)
 cabot-webgui 2017-10-24T21:37:11.79590875Z   File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
 cabot-webgui 2017-10-24T21:37:11.795911522Z     utility.execute()
 cabot-webgui 2017-10-24T21:37:11.795913877Z   File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 337, in execute
 cabot-webgui 2017-10-24T21:37:11.795916436Z     django.setup()
 cabot-webgui 2017-10-24T21:37:11.795918589Z   File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
 cabot-webgui 2017-10-24T21:37:11.795921016Z     apps.populate(settings.INSTALLED_APPS)
 cabot-webgui 2017-10-24T21:37:11.795923116Z   File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
 cabot-webgui 2017-10-24T21:37:11.795925516Z     app_config = AppConfig.create(entry)
 cabot-webgui 2017-10-24T21:37:11.79592774Z   File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
 cabot-webgui 2017-10-24T21:37:11.795930237Z     module = import_module(entry)
 cabot-webgui 2017-10-24T21:37:11.795932306Z   File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
 cabot-webgui 2017-10-24T21:37:11.795934702Z     __import__(name)
 cabot-webgui 2017-10-24T21:37:11.795936746Z ImportError: No module named cabot-check-network
@HorlogeSkynet
Copy link

Hello !

Same problem here, did you manage to get something working ? (I assume not)

Actually, Cabot gets a lack of documentation about Plugins (installation).
I've peeled the Wiki, but no trace about that...

If @JeanFred could guide us it'd be very cool 👌

Bye 👋

@nmarshall-cst
Copy link
Author

@HorlogeSkynet I have not figured this out quite yet. I scoured the documentation as well, but could not find anything to point me in the right direction. I would be happy to PR the documentation updates if we find a fix for this.

@HorlogeSkynet
Copy link

Yeah same for me !

Nevertheless, I'm onto something, keep you posted 👌

@HorlogeSkynet
Copy link

Okay, this is a way to do it apparently :

  1. git clone git@github.com:arachnys/cabot.git
  2. cd cabot/
  3. Add git to the Dockerfile dependencies, and add a new line : RUN git clone https://github.com/cabotapp/cabot-check-network.git && cd cabot-check-network/ && python setup.py install (because cabot_check_network is not present on PyPi repositories yet)
  4. Tweak the conf/development.env file with your information
  5. Adds the cabot_check_network plugin to conf/default.env
  6. docker-compose build
  7. docker-compose up

But it failed afterwards with :

web_1     | Traceback (most recent call last):
web_1     |   File "manage.py", line 11, in <module>
web_1     |     execute_from_command_line(sys.argv)
web_1     |   File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
web_1     |     utility.execute()
web_1     |   File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
web_1     |     self.fetch_command(subcommand).run_from_argv(self.argv)
web_1     |   File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
web_1     |     self.execute(*args, **cmd_options)
web_1     |   File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
web_1     |     output = self.handle(*args, **options)
web_1     |   File "/usr/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 83, in handle
web_1     |     executor = MigrationExecutor(connection, self.migration_progress_callback)
web_1     |   File "/usr/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
web_1     |     self.loader = MigrationLoader(self.connection)
web_1     |   File "/usr/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__
web_1     |     self.build_graph()
web_1     |   File "/usr/lib/python2.7/site-packages/django/db/migrations/loader.py", line 203, in build_graph
web_1     |     self.load_disk()
web_1     |   File "/usr/lib/python2.7/site-packages/django/db/migrations/loader.py", line 107, in load_disk
web_1     |     for name in os.listdir(directory):
web_1     | OSError: [Errno 20] Not a directory: '/usr/lib/python2.7/site-packages/cabot_check_network-0.1.0-py2.7.egg/cabot_check_network/migrations'

@HorlogeSkynet
Copy link

HorlogeSkynet commented Nov 22, 2017

Okay, I'm back 'cause I finally got it working. New procedure :

git clone git@github.com:arachnys/cabot.git
cd cabot/

Apply theses changes :

diff --git a/Dockerfile b/Dockerfile
index e9bd518..da3377b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,7 +15,8 @@ RUN apk add --no-cache \
         libffi-dev \
         openldap-dev \
         ca-certificates \
-        bash
+        bash \
+        wget

 RUN npm install -g \
         --registry http://registry.npmjs.org/ \
@@ -32,6 +33,7 @@ RUN pip install --no-cache-dir -r requirements-dev.txt

 COPY requirements-plugins.txt ./
 RUN pip install --no-cache-dir -r requirements-plugins.txt
+RUN wget https://github.com/cabotapp/cabot-check-network/archive/master.tar.gz && pip install --no-cache-dir master.tar.gz

 ADD . /code/

diff --git a/conf/default.env b/conf/default.env
index fd289b6..45c54e9 100644
--- a/conf/default.env
+++ b/conf/default.env
@@ -1,5 +1,5 @@
 # Plugins to be loaded at launch
-CABOT_PLUGINS_ENABLED=cabot_alert_hipchat,cabot_alert_twilio,cabot_alert_email,cabot_alert_slack
+CABOT_PLUGINS_ENABLED=cabot_alert_hipchat,cabot_alert_twilio,cabot_alert_email,cabot_alert_slack,cabot_check_network

 DEBUG=t
 DATABASE_URL=postgres://postgres@db:5432/postgres

Now tweak the conf/development.env file with your information, and once it's done run :

docker-compose build
docker-compose up

image


Now, if @JeanFred could explain how (if it's possible) we can add a plugin to existing Cabot containers, it'd be perfect !

@payton
Copy link

payton commented Mar 21, 2018

Thanks @HorlogeSkynet. Works great.

+1 on the request for explanation on adding plugin to existing Cabot containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants