Nesting JobDefs

322 views
Skip to first unread message

Michael Mol

unread,
May 29, 2015, 12:32:40 PM5/29/15
to bareos...@googlegroups.com
So, with 14.2, I have a scenario where I want separate Pool resources per client, and I have multiple Job resources per client. This means I need to define four lines of Pools per job, which is obviously a bit of a hassle.

Unless I can nest JobDefs, which would be a stupendous way to organize things cleanly. According to the Bareos docs:

"The JobDefs resource permits all the same directives that can appear in a Job resource. However, a JobDefs resource does not create a Job, rather it can be referenced within a Job to provide defaults for that Job. This permits you to concisely define several nearly identical Jobs, each one referencing a JobDefs resource which contains the defaults. Only the changes from the defaults need to be mentioned in each Job."

Great. A Job resource permits JobDefs directives, so if a JobDefs resource permits all directives a Job resource does, I should be able to have a JobDefs directive in a JobsDefs resource. Exactly what I need.

So here's roughly what I have in front of me. Only some hostnames have been changed:

JobDefs {
  Name = "DefaultJob"
  Type = Backup
  Level = Incremental
  Client = bareos-dir-fd
  FileSet = "SelfTest"                     # selftest fileset                            (#13)
  Schedule = "WeeklyCycle"
  Messages = Standard
  Priority = 10
  Write Bootstrap = "/var/lib/bareos/%c.bsr"
}

JobDefs {
  Name = "dbJob"
  JobDefs = "DefaultJob"
  Storage = File2
  Full Backup Pool = db-Full
  Differential Backup Pool = db-Differential
  Incremental Backup Pool = db-Incremental
  Pool = db-Incremental
}

Job {
  Name = "db"
  JobDefs = "dbJob"
}

Job {
  Name = "db-mysql"
  JobDefs = "dbJob"
  FileSet = "MySQL All"
}

When I try to start the director with this configuration, though, I get:

May 29 12:16:25 bareos.f.q.d.n bareos-dir[21335]: "Type" directive in Job "db" resource is required, but not found.

The "Type" director is right there in DefaultJob. If the "db" job resource isn't seeing it, that means DefaultJob isn't getting folded properly into the "dbJob" JobDefs resource before getting folded into the "db" job.

Am I nuts, or is this a bug?

Marco van Wieringen

unread,
May 29, 2015, 1:26:51 PM5/29/15
to bareos...@googlegroups.com
Michael Mol <mikemol <at> gmail.com> writes:

>
>
> The "Type" director is right there in DefaultJob. If the "db" job
> resource isn't seeing it, that means DefaultJob isn't getting
> folded properly into the "dbJob" JobDefs resource before getting
> folded into the "db" job.
>
> Am I nuts, or is this a bug?

Its not a bug recursive jobdefs have never been implemented in Bacula
(<= 5.2 later don't know) and also not in Bareos < 15.2.0. There is
experimental code in the current master code that does recursive
population of jobdefs as we recently implemented the proper resource
propagation abstraction allowing it to work.

--
Marco van Wieringen marco.van...@bareos.com
Bareos GmbH & Co. KG Phone: +49-221-63069389
http://www.bareos.com

Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
Komplementär: Bareos Verwaltungs-GmbH
Geschäftsführer: Stephan Dühr, M. Außendorf, J. Steffens,
P. Storz, M. v. Wieringen

Peter Bungert

unread,
May 29, 2015, 2:51:05 PM5/29/15
to Marco van Wieringen, bareos...@googlegroups.com

Using file include would work.

I don't rrmember the Syntax, but you could include a file several times.

BR peter

----------------------
Peter Bungert
Heinrich-Schwegler-Str. 3/1
69214 Eppelheim
Tel: +49-6221-7297666
Mobil: +49-176-50749175
pbungert @ web.de
----------------------

--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users...@googlegroups.com.
To post to this group, send email to bareos...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Mol

unread,
Jun 1, 2015, 3:13:27 PM6/1/15
to Marco van Wieringen, bareos...@googlegroups.com
On Fri, May 29, 2015 at 1:26 PM Marco van Wieringen <marco.van...@bareos.com> wrote:
Michael Mol <mikemol <at> gmail.com> writes:

>
>
> The "Type" director is right there in DefaultJob. If the "db" job
> resource isn't seeing it, that means DefaultJob isn't getting
> folded properly into the "dbJob" JobDefs resource before getting
> folded into the "db" job.
>
> Am I nuts, or is this a bug?
 
Its not a bug recursive jobdefs have never been implemented in Bacula (<= 5.2 later don't know) and also not in Bareos < 15.2.0. There is experimental code in the current master code that does recursive population of jobdefs as we recently implemented the proper resource propagation abstraction allowing it to work.


I'd have to argue it's a bug in documentation, then. I did try to do my due diligence by reading the docs first. :-|

Michael Mol

unread,
Jun 1, 2015, 3:22:59 PM6/1/15
to Peter Bungert, Marco van Wieringen, bareos...@googlegroups.com
On Fri, May 29, 2015 at 2:51 PM Peter Bungert <pbun...@web.de> wrote:

> Using file include would work.

> I don't rrmember the Syntax, but you could include a file several times.

Found it. Manual section 7.2.4: Including other Configuration Files

> If you wish to break your configuration file into smaller pieces, you can do so by including other files using the syntax @filename where filename is the full path and filename of another file. The @filename specification can be given anywhere a primitive token would appear.

> If you wish include all files in a specific directory, you can use the following:
> # Include subfiles associated with configuration of clients.
> # They define the bulk of the Clients, Jobs, and FileSets.
> # Remember to "reload" the Director after adding a client file.
> #
> @|"sh -c ’for f in /etc/bareos/clientdefs/*.conf ; do echo @${f} ; done’"

That ought to do it for me. Thanks!
Reply all
Reply to author
Forward
0 new messages