Use a variable for the path(s) to our needed files.

This commit is contained in:
parazyd 2018-10-05 16:21:03 +02:00
parent 7fce1b2cde
commit 234eb327ea
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
2 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,9 @@
from jenkins_creds import (jenkins_host, jenkins_cred) from jenkins_creds import (jenkins_host, jenkins_cred)
# Path to our files
pypath = '/var/lib/jenkins/toaster.do/jenkins_backend'
# Path to jenkins-cli.jar # Path to jenkins-cli.jar
jarpath = '/var/cache/jenkins/war/WEB-INF/jenkins-cli.jar' jarpath = '/var/cache/jenkins/war/WEB-INF/jenkins-cli.jar'

View File

@ -5,9 +5,10 @@ Module for backend talk with Jenkins executed by the web/CGI
from argparse import ArgumentParser from argparse import ArgumentParser
from subprocess import run from subprocess import run
from os.path import join
import html import html
from config import (jarargs, jobpath) from config import (jarargs, jobpath, pypath)
def add_job(jobname): def add_job(jobname):
@ -36,7 +37,7 @@ def add_job(jobname):
('ARCH', arch), ('ARCH', arch),
('COMMAND', command)] ('COMMAND', command)]
sdk_job = open('toasterbuild.xml', encoding='utf-8').read() sdk_job = open(join(pypath, 'toasterbuild.xml'), encoding='utf-8').read()
for i in replacements: for i in replacements:
sdk_job = sdk_job.replace('{{{%s}}}' % i[0], i[1]) sdk_job = sdk_job.replace('{{{%s}}}' % i[0], i[1])