From a14a810560de82ff5ddbbbd711079de9337dff83 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 1 Mar 2016 09:30:26 +0100 Subject: [PATCH] Fix #146 about update volume command line usage --- bacula/src/dird/ua_cmds.c | 2 +- bacula/src/dird/ua_update.c | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 33b93afcb4..e9cc9296d6 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -197,7 +197,7 @@ static struct cmdstruct commands[] = { /* C "\n\t pool= recycle= slot=\n\t inchanger=" "\n\t maxvolbytes= maxvolfiles= maxvoljobs=" "\n\t enabled= recyclepool= actiononpurge=" - "\n\t allfrompool= fromallpools"),true}, + "\n\t allfrompool= fromallpools frompool"),true}, { NT_("use"), use_cmd, _("Use catalog xxx"), NT_("catalog="), false}, { NT_("var"), var_cmd, _("Does variable expansion"), NT_(""), false}, { NT_("version"), version_cmd, _("Print Director version"), NT_(""), true}, diff --git a/bacula/src/dird/ua_update.c b/bacula/src/dird/ua_update.c index 9d1a1707f6..3ed16130e5 100644 --- a/bacula/src/dird/ua_update.c +++ b/bacula/src/dird/ua_update.c @@ -520,22 +520,31 @@ static int update_volume(UAContext *ua) NT_("InChanger"), /* 7 */ NT_("Slot"), /* 8 */ NT_("Pool"), /* 9 */ - NT_("FromPool"), /* 10 */ + NT_("FromPool"), /* 10 !!! see below !!! */ NT_("AllFromPool"), /* 11 !!! see below !!! */ NT_("Enabled"), /* 12 */ NT_("RecyclePool"), /* 13 */ NT_("ActionOnPurge"), /* 14 */ + NT_("FromAllPools"), /* 15 !!! see bellow !!! */ NULL }; -#define AllFromPool 11 /* keep this updated with above */ +#define FromPool 10 /* keep this updated */ +#define AllFromPool 11 /* keep this updated with above */ +#define FromAllPools 15 /* keep this updated */ for (i=0; kw[i]; i++) { int j; POOL_DBR pr; + /* No argv with these parameters */ + if (i == FromPool || i == FromAllPools) { + j = find_arg(ua, kw[i]); - if ((j=find_arg_with_value(ua, kw[i])) > 0) { - /* If all from pool don't select a media record */ - if (i != AllFromPool && !select_media_dbr(ua, &mr)) { + } else { + j = find_arg_with_value(ua, kw[i]); + } + if (j > 0) { + /* If all from pool/from all pools don't select a media record */ + if (i != AllFromPool && i != FromAllPools && !select_media_dbr(ua, &mr)) { return 0; } switch (i) { @@ -590,17 +599,14 @@ static int update_volume(UAContext *ua) case 14: update_vol_actiononpurge(ua, ua->argv[j], &mr); break; + case 15: + update_all_vols(ua); + break; } done = true; } } - /* Allow user to simply update all volumes */ - if (find_arg(ua, NT_("fromallpools")) > 0) { - update_all_vols(ua); - return 1; - } - for ( ; !done; ) { start_prompt(ua, _("Parameters to modify:\n")); add_prompt(ua, _("Volume Status")); /* 0 */ -- 2.39.5