MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / main

Function main

tools/cib_shadow.c:171–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169/* *INDENT-ON* */
170
171int
172main(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;

Callers

nothing calls this directly

Calls 15

crm_log_cli_initFunction · 0.85
crm_set_optionsFunction · 0.85
crm_helpFunction · 0.85
crm_get_optionFunction · 0.85
crm_bump_log_levelFunction · 0.85
safe_str_neqFunction · 0.85
get_shadow_fileFunction · 0.85
strerrorFunction · 0.85
shadow_teardownFunction · 0.85
cib_new_no_shadowFunction · 0.85
pcmk_strerrorFunction · 0.85
createEmptyCibFunction · 0.85

Tested by

no test coverage detected