| 169 | /* *INDENT-ON* */ |
| 170 | |
| 171 | int |
| 172 | main(int argc, char **argv) |
| 173 | { |
| 174 | int rc = 0; |
| 175 | int flag; |
| 176 | int argerr = 0; |
| 177 | static int command = '?'; |
| 178 | char *shadow = NULL; |
| 179 | char *shadow_file = NULL; |
| 180 | gboolean full_upload = FALSE; |
| 181 | gboolean dangerous_cmd = FALSE; |
| 182 | struct stat buf; |
| 183 | int option_index = 0; |
| 184 | |
| 185 | crm_log_cli_init("crm_shadow"); |
| 186 | crm_set_options(NULL, "(query|command) [modifiers]", long_options, |
| 187 | "Perform configuration changes in a sandbox before updating the live cluster." |
| 188 | "\n\nSets up an environment in which configuration tools (cibadmin, crm_resource, etc) work" |
| 189 | " offline instead of against a live cluster, allowing changes to be previewed and tested" |
| 190 | " for side-effects.\n"); |
| 191 | |
| 192 | if (argc < 2) { |
| 193 | crm_help('?', EX_USAGE); |
| 194 | } |
| 195 | |
| 196 | while (1) { |
| 197 | flag = crm_get_option(argc, argv, &option_index); |
| 198 | if (flag == -1 || flag == 0) |
| 199 | break; |
| 200 | |
| 201 | switch (flag) { |
| 202 | case 'a': |
| 203 | full_upload = TRUE; |
| 204 | break; |
| 205 | case 'd': |
| 206 | case 'E': |
| 207 | case 'p': |
| 208 | case 'w': |
| 209 | case 'F': |
| 210 | command = flag; |
| 211 | free(shadow); |
| 212 | shadow = strdup(getenv("CIB_shadow")); |
| 213 | break; |
| 214 | case 'e': |
| 215 | case 'c': |
| 216 | case 's': |
| 217 | case 'r': |
| 218 | command = flag; |
| 219 | free(shadow); |
| 220 | shadow = strdup(optarg); |
| 221 | break; |
| 222 | case 'C': |
| 223 | case 'D': |
| 224 | command = flag; |
| 225 | dangerous_cmd = TRUE; |
| 226 | free(shadow); |
| 227 | shadow = strdup(optarg); |
| 228 | break; |
nothing calls this directly
no test coverage detected