Example #1
0
	def mksource(self, htdocs):
		'''
		write source html template (placeholders)
		'''
		try:
			path = '%s%s' % (htdocs, 'index.html')
			soy.commit(self.pillar['index'], path, **self.__dict__)
			self.salt['nginx.signal']('reload')
			return True
		except (OSError, IOError):
			raise OSError
Example #2
0
    def mksource(self, htdocs):
        '''
		write source html template (placeholders)
		'''
        try:
            path = '%s%s' % (htdocs, 'index.html')
            soy.commit(self.pillar['index'], path, **self.__dict__)
            self.salt['nginx.signal']('reload')
            return True
        except (OSError, IOError):
            raise OSError
Example #3
0
	def mkconf(self):
		'''
		write and symlink nginx host files from template.
		'''
		try:
			available = '%s%s.conf' % (self.pillar['available'], self.host)
			enabled = '%s%s.conf' % (self.pillar['enabled'], self.host)
			soy.commit(self.pillar['template'], available, **self.__dict__)
			self.salt['file.symlink'](available, enabled)
			return True
		except (OSError, IOError):
			return False
Example #4
0
    def mkconf(self):
        '''
		write and symlink nginx host files from template.
		'''
        try:
            available = '%s%s.conf' % (self.pillar['available'], self.host)
            enabled = '%s%s.conf' % (self.pillar['enabled'], self.host)
            soy.commit(self.pillar['template'], available, **self.__dict__)
            self.salt['file.symlink'](available, enabled)
            return True
        except (OSError, IOError):
            return False
Example #5
0
	def suspend(self):
		'''
		suspend users and their hosts
		'''
		try:
			path = '%s%s.conf' % (self.pillar['available'], self.host)
			link = '%s%s.conf' % (self.pillar['enabled'], self.host)
			self.salt['file.remove'](link)
			self.salt['file.remove'](path)
			soy.commit(self.pillar['susconf'], path, **self.__dict__)
			self.salt['file.symlink'](path, link)
			self.salt['nginx.signal']('reload')
			return True
		except (OSError, IOError):
			return False
Example #6
0
    def suspend(self):
        '''
		suspend users and their hosts
		'''
        try:
            path = '%s%s.conf' % (self.pillar['available'], self.host)
            link = '%s%s.conf' % (self.pillar['enabled'], self.host)
            self.salt['file.remove'](link)
            self.salt['file.remove'](path)
            soy.commit(self.pillar['susconf'], path, **self.__dict__)
            self.salt['file.symlink'](path, link)
            self.salt['nginx.signal']('reload')
            return True
        except (OSError, IOError):
            return False
Example #7
0
 def test_pass(self):
     rv = soy.commit('/tmp/test', '/tmp/test', **{})
     ok_(rv == True, 'returned %s' % rv)
Example #8
0
 def test_fail(self):
     rv = soy.commit('/tmp/', '/tmp/', **{})
     ok_(rv is False, 'returned %s' % rv)