body common control
{
      inputs => { "../../default.sub.cf", "../../run_with_server.cf.sub" };
      bundlesequence => { create_directories, default("$(this.promise_filename)") };
      version => "1.0";
}

bundle agent test
{
  methods:
      # source file - on purpose in G.testroot instead of G.testdir
      # since the former is admitted while the latter is denied.
      "any" usebundle => file_make("$(G.testroot)/source_file",
                                   "This is the source file to copy $(sys.date) - always fresh");
      # destination files
      "any" usebundle => dcs_fini("$(G.testdir)/server1_classic");
      "any" usebundle => dcs_fini("$(G.testdir)/server1_latest");
      "any" usebundle => dcs_fini("$(G.testdir)/server2_classic");
      "any" usebundle => dcs_fini("$(G.testdir)/server2_latest");

      "any" usebundle => generate_key;
      "any" usebundle => start_server("$(this.promise_dirname)/localhost_deny_one_directory.srv");
      "any" usebundle => start_server("$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv");

      "any" usebundle => run_test("$(this.promise_filename).sub");

      "any" usebundle => stop_server("$(this.promise_dirname)/localhost_deny_one_directory.srv");
      "any" usebundle => stop_server("$(this.promise_dirname)/localhost_deny_one_directory_with_regex.srv");
}

# For the access rules in cf-serverd to work recursively, the paths must exist and be directories
bundle agent create_directories
{
  files:
      "$(G.testroot)/."
      create => "true";
      "$(G.testdir)/."
      create => "true";
}
