Skip to content

Instantly share code, notes, and snippets.

@kamermans
Created July 13, 2020 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamermans/886d063933790d4cfb2ea417f2e6399a to your computer and use it in GitHub Desktop.
Save kamermans/886d063933790d4cfb2ea417f2e6399a to your computer and use it in GitHub Desktop.
Nested Varnish directors errors
vcl 4.0;
import directors;
backend alpha { .host = "192.168.0.101"; }
backend bravo { .host = "192.168.0.102"; }
sub vcl_init {
new primary_director = directors.random();
primary_director.add_backend(alpha, 1.0);
new secondary_director = directors.random();
secondary_director.add_backend(bravo, 1.0);
new fallback_director = directors.fallback();
fallback_director.add_backend(primary_director);
fallback_director.add_backend(secondary_director);
}
$ varnishd -F -f test.vcl
Error:
Message from VCC-compiler:
Symbol not found: 'primary_director' (expected type BACKEND):
('test.vcl' Line 15 Pos 35)
fallback_director.add_backend(primary_director);
----------------------------------################--
('test.vcl' Line 15 Pos 5) -- ('test.vcl' Line 15 Pos 34)
fallback_director.add_backend(primary_director);
----##############################------------------
Running VCC-compiler failed, exited with 2
VCL compilation failed
$ varnishd -F -f test.vcl
Error:
Message from VCC-compiler:
Expression has type INSTANCE, expected BACKEND
('/etc/varnish/test.vcl' Line 15 Pos 35) -- (Pos 50)
fallback_director.add_backend(primary_director);
----------------------------------################--
Expected argument: BACKEND (unnamed argument)
While compiling function call:
('/etc/varnish/test.vcl' Line 15 Pos 5) -- (Pos 50)
fallback_director.add_backend(primary_director);
----##############################################--
Running VCC-compiler failed, exited with 2
VCL compilation failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment