Skip to content

Commit e3a33d1

Browse files
committed
bump version 0.2.3
- Use su -l in mock-client.service file. Mock require properly logged in user to work. - sign file send request with signature.
1 parent 1c0034f commit e3a33d1

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

mock-client.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ const downloadSRPM = function(url, dest, cb) {
238238
if (response.statusCode !== 200) {
239239
cb(true);
240240
} else {
241-
if(response.headers['content-type'] != 'application/x-rpm') {
241+
if (response.headers['content-type'] != 'application/x-rpm') {
242242
cb(true);
243243
}else {
244244
fs.writeFile(dest, body, function(err) {
@@ -312,7 +312,7 @@ const runMock = function(task) {
312312
task.log = task.log + 'mock ' + process.env.MOCK_OPTIONS
313313
+ ' -r ' + process.env.MOCK_CONFIG
314314
+ ' --rebuild ' + ROOTDIR + 'tasks/' + task.tid + '/' + path.basename(task.url)
315-
+ ' --resultdir ' + ROOTDIR + 'tasks/' + task.tid + '/result' + "\n";
315+
+ ' --resultdir ' + ROOTDIR + 'tasks/' + task.tid + '/result' + '\n';
316316

317317
mockRun.stdout.on('data', function(data) {
318318
task.log = task.log + 'stdout: ' + data;
@@ -386,17 +386,19 @@ const sendFile = function(task, file) {
386386
var url = process.env.MOCK_SERVER + '/api/task/' + task.tid;
387387
debug.log(' POST to: %s',url);
388388

389+
var fileContent = fs.readFileSync(file);
389390
var headers = {
390391
token: token,
391392
'User-Agent': 'RestClient.' + process.env.npm_package_version,
392393
'content-type': 'application/x-redhat-package-manager',
393394
filename: path.basename(file),
395+
signature: 'sha256=' + require('./includes/signature.js')('sha256', fileContent, process.env.SECRET)
394396
}
395397

396398
request({
397399
method: 'POST',
398400
url: url,
399-
body: fs.readFileSync(file),
401+
body: fileContent,
400402
headers: headers
401403
}, function optionalCallback(err, httpResponse, body) {
402404
if (err) {

mock-client.service

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ After=syslog.target
44

55
[Service]
66
Environment=DEBUG=*:log
7-
ExecStart=/usr/bin/mock-client
8-
ExecStop=/bin/rm -f /var/run/mock-client.pid
9-
User=mockclient
10-
Group=mock
7+
ExecStart=/usr/bin/su -l mockclient -c /usr/bin/mock-client
118
Restart=on-failure
129

1310
[Install]

mock-client.spec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: mock-client
2-
Version: 0.2.2
2+
Version: 0.2.3
33
Release: 1%{?dist}
44
Summary: Mock.fedberry.org agent to run builds.
55

@@ -90,10 +90,13 @@ cp mock-client.service %{buildroot}%{_unitdir}/mock-client.service
9090
%{_unitdir}/mock-client.service
9191

9292
%changelog
93+
* Tue Nov 8 2016 Gor Martsen <gor@fedberry.org> - 0.2.3-1
94+
- Use su -l in mock-client.service file. Mock require properly logged in user to work.
95+
- sign file send request with signature.
96+
9397
* Mon Nov 7 2016 Gor Martsen <gor@fedberry.org> - 0.2.2-1
9498
- Use direct pach /usr/bin/mock to avoid path conflict with /usr/sbin/mock.
9599

96-
97100
* Mon Nov 7 2016 Gor Martsen <gor@fedberry.org> - 0.2.1-1
98101
- Enable and start service.
99102
- Fix issue with url trim.

0 commit comments

Comments
 (0)