Commit 4d9fec98 authored by Leo Iannacone's avatar Leo Iannacone

Provide JSONLogger debomatic module along with

this interface.

Update README e config.js according with.
parent 68aa787a
......@@ -5,22 +5,30 @@ debomatic-webui
This interface is built up on [node](http://nodejs.org/) platform and uses intensely [socket.io](http://socket.io/) and [jquery](http://jquery.com/) technologies.
Whenever you want to leave a suggestion or file a bug report, please open a [new issue](https://github.com/LeoIannacone/debomatic-webui/issues).
## Installation
## Requirements
Installation is very simple.
You need **JSONLogger** debomatic module (provided along with this interface) to get installed in debomatic.
You can copy `debomatic-modules/JSONLogger.py` or link to the modules directory. In the most cases:
```
sudo cp debomatic-modules/JSONLogger.py /usr/share/debomatic/modules/
```
Restart debomatic service.
1. First of all, you need `npm` and `nodejs` installed on your system. On debian like systems type this in a command line:
```
Install **npm** and **nodejs** on your system. On debian like systems type this in a command line:
```
sudo apt-get install npm nodejs
```
2. Then move to `debomatic-webui/` directory and type:
## Installation
Move to **debomatic-webui/** directory and type:
```
npm install
```
That command downloads node depenences locally and creates the `user.config.js` file.
That command downloads node dependences locally and creates automatically user configuration file.
2. Take a look at `user.config.js`. Edit as you wish and then run service with:
Take a look at auto-generated **user.config.js**. Edit as you wish and then run service with:
```
nodejs index.js
```
......
# Deb-o-Matic - JSON logger module
#
# Copyright (C) 2014 Leo Iannacone
#
# Authors: Leo Iannacone <l3on@ubuntu.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Log information about building packages in a JSON format.
import os
from json import dumps as toJSON
class DebomaticModule_JSONLogger:
def __init__(self):
self.logfile = '/var/log/debomatic-json.log'
def _set_logfile(self, args):
if args['opts'].has_section('jsonlogger'):
self.logfile = args['opts'].get('jsonlogger', 'jsonfile').strip()
def _get_info(self, args):
keys = ['package', 'distribution', 'uploader']
info = {}
for k in keys:
if args.has_key(k):
info[k] = args[k]
return info
def pre_build(self, args):
self._set_logfile(args)
with open(self.logfile, 'a') as fd:
package = self._get_info(args)
package['status'] = 'building'
json = toJSON(package)
fd.write(json + '\n')
def post_build(self, args):
self._set_logfile(args)
with open(self.logfile, 'a') as fd:
status = 'build-failed'
package = self._get_info(args)
resultdir = os.path.join(args['directory'], 'pool', args['package'])
for filename in os.listdir(resultdir):
if filename.endswith('.dsc'):
status = 'build-successed'
break
package['status'] = status
json = toJSON(package)
fd.write(json + '\n')
......@@ -21,7 +21,7 @@ config.socket.log = false
config.debomatic = {}
config.debomatic.path = '/srv/debomatic-amd64'
config.debomatic.jsonfile = '/var/log/debomatic.json'
config.debomatic.jsonfile = '/var/log/debomatic-json.log'
config.routes = {}
config.routes.debomatic = '/debomatic'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment