Skip to content

Commit

Permalink
Univention: fix exporting fd configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
joergsteffens committed Sep 23, 2016
1 parent 0ff0c57 commit 094e67d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
6 changes: 4 additions & 2 deletions debian/bareos-director.postinst.in
Expand Up @@ -25,8 +25,10 @@ CONFIGDIR="/etc/bareos/bareos-dir.d/"

permissions()
{
chown ${daemon_user}:${daemon_group} /etc/bareos/bareos-dir-export/
chmod 750 /etc/bareos/bareos-dir-export/
for dir in /etc/bareos/bareos-dir-export/ /etc/bareos/bareos-dir-export/client; do
chown ${daemon_user}:${daemon_group} "$dir"
chmod 750 "$dir"
done
}

case "$1" in
Expand Down
4 changes: 2 additions & 2 deletions platforms/univention/job-generic.template
@@ -1,6 +1,6 @@
Client {
Name = "${client_name}-fd"
Address = "$client_name"
Address = "${client_name}"
Password = "${password}"
}

Expand All @@ -10,5 +10,5 @@ Job {
JobDefs = "DefaultJob"
FileSet = "LinuxAll"
Schedule = "WeeklyCycle"
Enabled = "$enable"
Enabled = "${enable}"
}
4 changes: 2 additions & 2 deletions platforms/univention/job-windows.template
@@ -1,6 +1,6 @@
Client {
Name = "${client_name}-fd"
Address = "$client_name"
Address = "${client_name}"
Password = "${password}"
}

Expand All @@ -10,5 +10,5 @@ Job {
JobDefs = "DefaultJob"
FileSet = "Windows All Drives"
Schedule = "WeeklyCycle"
Enabled = "$enable"
Enabled = "${enable}"
}
12 changes: 8 additions & 4 deletions platforms/univention/univention-bareos.py
Expand Up @@ -11,8 +11,8 @@
import stat

import univention.debug as ud
import subprocess
import string
from subprocess import Popen, PIPE, STDOUT
import random

name = 'bareos'
Expand All @@ -23,7 +23,7 @@
PATH_PREFIX='/etc/bareos/autogenerated'
JOBS_PATH=PATH_PREFIX+'/clients'
INCLUDES_PATH=PATH_PREFIX+'/clients.include'
BCONSOLE_CMD='/usr/bin/bconsole'
BCONSOLE_CMD=['/usr/bin/bconsole']

JOB_DISABLED='Not'

Expand Down Expand Up @@ -113,8 +113,12 @@ def removeClient(client_name,client_type):
def getClientSecret(client_name):
return createClientSecret(client_name)

def exportBareosFdDirectorResource(client_name,client_type):
subprocess.call('echo configure export client="{client_name} | {bconsole}'.format(client='bareos-fd', bconsole=BCONSOLE_CMD), shell=True)
def exportBareosFdDirectorResource(client_name, client_type):
# send commands via pipe to bconsole
process = Popen(BCONSOLE_CMD, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
# additional reload required, to gurantee that client is known to director
out = process.communicate(b'reload\nconfigure export client="{client_name}-fd"\n'.format(client_name=client_name))[0]
ud.debug(ud.LISTENER, ud.INFO, "bareos export output:\n" + str(out))

def createClientSecret(client_name):
char_set = string.ascii_uppercase + string.digits + string.ascii_lowercase
Expand Down

0 comments on commit 094e67d

Please sign in to comment.