def prepare(self): super(Hooks, self).prepare() self.template('txstatsd.conf.template', '/etc/yola/txstatsd.conf') logfile = self.config.get(self.app).path.log if logfile: touch(logfile, 'root', 'adm', 0o640)
def test_uid(self): # We probably aren't root... my_user = pwd.getpwuid(os.getuid())[0] my_group = grp.getgrgid(os.getgid())[0] touch(self.tmppath('foo'), user=my_user, group=my_group) s = os.stat(self.tmppath('foo')) self.assertEqual(s.st_uid, os.getuid()) self.assertEqual(s.st_gid, os.getgid())
def test_simple(self): f = self.tmppath('test.txt') touch(f) d = self.mkdir('foo', 'bar') self.assertTrue(os.path.exists(f)) self.assertTrue(os.path.exists(d)) delete_dir_content(self.tmppath()) self.assertFalse(os.path.exists(f)) self.assertFalse(os.path.exists(d))
def prepare_logfiles(self): path = self.config.get(self.app, {}).get('path', {}) logs = [path.get('log'), path.get('celery_log')] for logfile in logs: if not logfile: continue with ignoring(errno.EEXIST): os.mkdir(os.path.dirname(logfile)) touch(logfile, self.log_user, self.log_group, 0640)
def prepare(self): super(Hooks, self).prepare() data_dir = os.path.join(self.root, 'data') webapp_dir = glob.glob(self.deploy_path('virtualenv', 'lib', 'python2.*', 'site-packages', 'graphite_web-*', 'webapp')) os.symlink(data_dir, self.deploy_path('storage')) os.symlink(webapp_dir[0], self.deploy_path('webapp')) os.symlink(self.deploy_path(self.app, 'conf'), self.deploy_path('conf')) log_dir = self.config.graphite.path.log_dir if not os.path.exists(log_dir): os.mkdir(log_dir) if not os.path.exists(os.path.join(log_dir, 'info.log')): touch(os.path.join(log_dir, 'info.log')) if not os.path.exists(os.path.join(log_dir, 'exception.log')): touch(os.path.join(log_dir, 'exception.log')) chown_r(log_dir, 'www-data', 'www-data')
def test_perm(self): touch(self.tmppath('foo'), perm=0641) s = os.stat(self.tmppath('foo')) self.assertEqual(stat.S_IMODE(s.st_mode), 0641)
def test_simple(self): touch(self.tmppath('foo')) self.assertTMPPExists('foo')