Example #1
0
 def test_add_with_env_inherit(self):
     """Test that add with optional gid works"""
     ctllib.add(self.places, 'hello', cmd='/bin/echo', args=['hello'],
                env_inherit=['PATH'])
     fname = os.path.join(self.places.config, 'hello')
     d = jsonFrom(fname)
     self.assertEquals(d['env_inherit'], ['PATH'])
Example #2
0
 def test_add_with_gid(self):
     """Test that add with optional gid works"""
     ctllib.add(self.places, 'hello', cmd='/bin/echo', args=['hello'],
                gid=1024)
     fname = os.path.join(self.places.config, 'hello')
     d = jsonFrom(fname)
     self.assertEquals(d, dict(gid=1024, args=['/bin/echo', 'hello']))
Example #3
0
 def test_add_and_remove(self):
     """Test that add/remove work"""
     ctllib.add(self.places, 'hello', cmd='/bin/echo', args=['hello'])
     fname = os.path.join(self.places.config, 'hello')
     d = json.loads(file(fname).read())
     self.assertEquals(d, dict(args=['/bin/echo', 'hello']))
     ctllib.remove(self.places, 'hello')
     self.assertFalse(os.path.exists(fname))
Example #4
0
 def test_add_and_remove(self):
     """Test that add/remove work"""
     ctllib.add(self.places, 'hello', cmd='/bin/echo', args=['hello'])
     fname = os.path.join(self.places.config, 'hello')
     d = json.loads(file(fname).read())
     self.assertEquals(d, dict(args=['/bin/echo', 'hello']))
     ctllib.remove(self.places, 'hello')
     self.assertFalse(os.path.exists(fname))
Example #5
0
def main(args):
    cmdLine = run.calcCommandline()
    places = run.mkconfig('boredbot-config')
    ctllib.add(places, 'boredbot', cmd=cmdLine[0], args=cmdLine[1:] + ['loop'],
               env=['SECRET_KEY='+os.environ['SECRET_KEY']])
    ctllib.add(places, 'boredweb', cmd=cmdLine[0], args=cmdLine[1:] + ['gunicorn', '--bind', '0.0.0.0:8000', '-w', '4', 'boredbot_deploy.wsgi:app'],
               env=['SECRET_KEY='+os.environ['SECRET_KEY']])
    sys.argv = ['twistd', '--nodaemon', 'ncolony', '--messages', places.messages, '--config', places.config]
    twistd.run()
Example #6
0
 def test_add_with_gid(self):
     """Test that add with optional gid works"""
     ctllib.add(self.places,
                'hello',
                cmd='/bin/echo',
                args=['hello'],
                gid=1024)
     fname = os.path.join(self.places.config, 'hello')
     d = json.loads(file(fname).read())
     self.assertEquals(d, dict(gid=1024, args=['/bin/echo', 'hello']))
Example #7
0
 def test_add_with_env_and_extras(self):
     """Test that add with optional environment works"""
     extras = dict(goodbye=[1, 2, 3])
     ctllib.add(self.places, 'hello', cmd='/bin/echo',
                args=['hello'], env=['world=616'], extras=extras)
     fname = os.path.join(self.places.config, 'hello')
     d = json.loads(file(fname).read())
     self.assertEquals(d, dict(env={'world': '616'},
                               goodbye=[1, 2, 3],
                               args=['/bin/echo', 'hello']))
Example #8
0
 def test_add_with_env_and_extras(self):
     """Test that add with optional environment works"""
     extras = dict(goodbye=[1, 2, 3])
     ctllib.add(self.places,
                'hello',
                cmd='/bin/echo',
                args=['hello'],
                env=['world=616'],
                extras=extras)
     fname = os.path.join(self.places.config, 'hello')
     d = json.loads(file(fname).read())
     self.assertEquals(
         d,
         dict(env={'world': '616'},
              goodbye=[1, 2, 3],
              args=['/bin/echo', 'hello']))
Example #9
0
 def test_add_with_uid(self):
     """Test that add with optional uid works"""
     ctllib.add(self.places, 'hello', cmd='/bin/echo', args=['hello'], uid=1024)
     fname = os.path.join(self.places.config, 'hello')
     d = json.loads(file(fname).read())
     self.assertEquals(d, dict(uid=1024, args=['/bin/echo', 'hello']))
Example #10
0
def addService(name, serviceName, args, extras=None):
    baseArgs = getBaseArgs(name)
    args = baseArgs + [serviceName] + args
    ctllib.add(places, name=name, cmd=twistd, args=args, extras=extras)