Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #4 from frankban/exterminate-mongo
Browse files Browse the repository at this point in the history
Exterminate mongo
  • Loading branch information
frankban authored Mar 7, 2018
2 parents a59b658 + 13610a5 commit 1635a0f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 19 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: python

services:
- mongodb

sudo: false

before_install:
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: switchboard
Maintainer: Jay R. Wren <[email protected]>
Section: python
Priority: optional
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7), python-formencode, python-pymongo, python-blinker, python-webob, python-mako, python-decorator, dh-python
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7), python-formencode, python-sqlalchemy, python-blinker, python-webob, python-mako, python-decorator, dh-python
Standards-Version: 3.9.1

Package: python-switchboard
Expand Down
18 changes: 6 additions & 12 deletions docs/user-documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,9 @@ Switchboard has only a handful of settings, none of which are required:
+------------------------------+-------------+--------------------------------+
| Key | Default | Description |
+==============================+=============+================================+
| switchboard.mongo_host | localhost | The host for MongoDB. |
| switchboard.dburl | | The db URL. |
+------------------------------+-------------+--------------------------------+
| switchboard.mongo_port | 27017 | The port for MongoDB. |
+------------------------------+-------------+--------------------------------+
| switchboard.mongo_db | switchboard | The database name. |
+------------------------------+-------------+--------------------------------+
| switchboard.mongo_collection | switches | The collection name. |
| switchboard.dbtable | switchboard | The DB table to use. |
+------------------------------+-------------+--------------------------------+
| switchboard.internal_ips | | Comma-delimited list of IPs. |
+------------------------------+-------------+--------------------------------+
Expand All @@ -106,13 +102,11 @@ argument can be omitted.

An example configuration that needs ``nested=True``::

switchboard.mongo_host=mongodb.example.org
switchboard.mong_port=27018
switchboard.dburl=postgresql://user:[email protected]:5432/switches

And one that does not need ``nested=True``::

mongo_host=mongodb.example.org
mong_port=27018
dburl=postgresql://user:[email protected]:5432/switches

The Admin UI
^^^^^^^^^^^^
Expand Down Expand Up @@ -159,15 +153,15 @@ Caching
^^^^^^^

By default, switchboard will query all the switches every time one is checked. In
many applications, this may be more mongo queries than desired. Switchboard supports
many applications, this may be more queries than desired. Switchboard supports
a cache system, e.g. via memcache::

import pylibmc

memcache_client = pylibmc.Client(['127.0.0.1'])
switchboard.configure(config, cache=memcache_client)

This does require memcache to be running, but limits mongodb queries to only occur
This does require memcache to be running, but limits queries to only occur
after a switch is changed and the cache is invalidated.

Custom cache objects can be used instead of a memcache client, to implement different caching
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

version = '2.0.1'
version = '2.0.2'

setup(name='switchboard',
version=version,
Expand Down
2 changes: 1 addition & 1 deletion switchboard/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class ModelDict(CachedDict):
Specifying ``instances=True`` will cause the cache to store instances
rather than simple values.
If ``auto_create=True`` accessing mongodict[key] when key does not exist
If ``auto_create=True`` accessing modeldict[key] when key does not exist
will attempt to create it in the collection.
Functions in two different ways, depending on the constructor:
Expand Down
1 change: 0 additions & 1 deletion switchboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import logging

from blinker import signal
from pymongo import DESCENDING

from .settings import settings
from .store import InMemoryStore
Expand Down

0 comments on commit 1635a0f

Please sign in to comment.