where a central facility is used to push VCL's to a number of Varnish
hosts.
Until a VCL is loaded, the child process cannot be started.
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2699
d4fa192b-c00b-0410-8231-
f00ffab90ce4
void mgt_vcc_init(void);
int mgt_vcc_default(const char *bflag, const char *fflag, int f_fd, int Cflag);
int mgt_push_vcls_and_start(unsigned *status, char **p);
+int mgt_has_vcl(void);
extern char *mgt_cc_cmd;
#include "hash_slinger.h"
printf("rolling(1)...\n");
fprintf(stderr, "rolling(2)...\n");
- if (!dflag)
+ if (!dflag && !mgt_has_vcl())
+ fprintf(stderr, "No VCL loaded yet\n");
+ else if (!dflag)
start_child();
else
fprintf(stderr,
(void)av;
if (priv != NULL && child_state == CH_RUNNING)
stop_child();
- else if (priv == NULL && child_state == CH_STOPPED)
- start_child();
- else {
+ else if (priv == NULL && child_state == CH_STOPPED) {
+ if (mgt_has_vcl())
+ start_child();
+ else {
+ cli_result(cli, CLIS_CANT);
+ cli_out(cli, "No VCL available");
+ }
+ } else {
cli_result(cli, CLIS_CANT);
cli_out(cli, "Child in state %s", ch_state[child_state]);
}
/*--------------------------------------------------------------------*/
+int
+mgt_has_vcl()
+{
+
+ return (!VTAILQ_EMPTY(&vclhead));
+}
+
+/*--------------------------------------------------------------------*/
+
int
mgt_push_vcls_and_start(unsigned *status, char **p)
{
fprintf(stderr, "Only one of -b or -f can be specified\n");
usage();
}
- if (b_arg == NULL && f_arg == NULL) {
- fprintf(stderr, "One of -b or -f must be specified\n");
- usage();
- }
if (f_arg != NULL) {
f_fd = open(f_arg, O_RDONLY);
exit(1);
}
- if (mgt_vcc_default(b_arg, f_arg, f_fd, C_flag))
- exit (2);
+ if (b_arg != NULL || f_arg != NULL)
+ if (mgt_vcc_default(b_arg, f_arg, f_fd, C_flag))
+ exit (2);
if (C_flag)
exit (0);