Skip to content

Commit e538816

Browse files
Merge branch 'master' into TB1OVI3-23-adding-new-host-to-engine-waits-too-long-for-host-reboot
2 parents 433572d + f453110 commit e538816

File tree

1,260 files changed

+3503
-3505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,260 files changed

+3503
-3505
lines changed

backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/aaa/AAAServiceImpl.java

+31-31
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private enum Action {
9191
module.argMap.get("user-name")
9292
).mput(
9393
Authn.InvokeKeys.CREDENTIALS,
94-
getPassword((String)module.argMap.get("password"))
94+
getPassword((String) module.argMap.get("password"))
9595
)
9696
);
9797
log.info(
@@ -113,13 +113,13 @@ private enum Action {
113113
),
114114
CHANGE_CREDENTIALS(
115115
module -> {
116-
AAAProfile aaaprofile = module.new AAAProfile((String)module.argMap.get("profile"));
116+
AAAProfile aaaprofile = module.new AAAProfile((String) module.argMap.get("profile"));
117117
if ((aaaprofile.getAuthnExtension().getContext().<Long>get(Authn.ContextKeys.CAPABILITIES, 0L) & Authn.Capabilities.CREDENTIALS_CHANGE) == 0 &&
118-
!(Boolean)module.argMap.get("ignore-capabilities")) {
118+
!(Boolean) module.argMap.get("ignore-capabilities")) {
119119
throw new IllegalArgumentException("Unsupported operation: CREDENTIALS_CHANGE");
120120
}
121121

122-
String user = aaaprofile.mapUser((String)module.argMap.get("user-name"));
122+
String user = aaaprofile.mapUser((String) module.argMap.get("user-name"));
123123
log.info("API: -->Authn.InvokeCommands.CREDENTIALS_CHANGES profile='{}' user='{}'", aaaprofile.getProfile(), user);
124124
ExtMap outMap = aaaprofile.getAuthnExtension().invoke(
125125
new ExtMap().mput(
@@ -130,10 +130,10 @@ private enum Action {
130130
user
131131
).mput(
132132
Authn.InvokeKeys.CREDENTIALS,
133-
getPassword((String)module.argMap.get("password"))
133+
getPassword((String) module.argMap.get("password"))
134134
).mput(
135135
Authn.InvokeKeys.CREDENTIALS_NEW,
136-
getPassword((String)module.argMap.get("password-new"), "New password: ")
136+
getPassword((String) module.argMap.get("password-new"), "New password: ")
137137
)
138138
);
139139
log.info(
@@ -151,8 +151,8 @@ private enum Action {
151151
),
152152
LOGIN_USER(
153153
module -> {
154-
AAAProfile aaaprofile = module.new AAAProfile((String)module.argMap.get("profile"));
155-
String user = aaaprofile.mapUser((String)module.argMap.get("user-name"));
154+
AAAProfile aaaprofile = module.new AAAProfile((String) module.argMap.get("profile"));
155+
String user = aaaprofile.mapUser((String) module.argMap.get("user-name"));
156156
log.info("API: -->Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS profile='{}' user='{}'", aaaprofile.getProfile(), user);
157157
ExtMap outMap = aaaprofile.getAuthnExtension().invoke(
158158
new ExtMap().mput(
@@ -163,7 +163,7 @@ private enum Action {
163163
user
164164
).mput(
165165
Authn.InvokeKeys.CREDENTIALS,
166-
getPassword((String)module.argMap.get("password"))
166+
getPassword((String) module.argMap.get("password"))
167167
)
168168
);
169169
log.info(
@@ -192,7 +192,7 @@ private enum Action {
192192
);
193193
}
194194

195-
if(aaaprofile.getMappingExtension() != null) {
195+
if (aaaprofile.getMappingExtension() != null) {
196196
log.info("API: -->Mapping.InvokeCommands.MAP_AUTH_RECORD");
197197
Dump.AUTH_RECORD.dump(module, authRecord);
198198
authRecord = aaaprofile.getMappingExtension().invoke(
@@ -302,7 +302,7 @@ private enum Action {
302302
SEARCH(
303303
module -> {
304304
ExtensionProxy authzExtension = module.getExtensionsManager().getExtensionByName((String) module.argMap.get("extension-name"));
305-
ExtUUID entity = getQueryEntity((String)module.argMap.get("entity"));
305+
ExtUUID entity = getQueryEntity((String) module.argMap.get("entity"));
306306
ExtMap filter = createQueryFilter(entity, module.argMap);
307307
Dump.QUERY_FILTER_RECORD.dump(module, filter, "");
308308

@@ -311,7 +311,7 @@ private enum Action {
311311
Collections.<String>emptyList()
312312
);
313313
if (module.argMap.get("namespace") != null) {
314-
namespaces = (Collection<String>)module.argMap.get("namespace");
314+
namespaces = (Collection<String>) module.argMap.get("namespace");
315315
}
316316

317317
for (String namespace : namespaces) {
@@ -325,7 +325,7 @@ private enum Action {
325325
entity
326326
).mput(
327327
Authz.InvokeKeys.QUERY_FLAGS,
328-
getAuthzFlags((List<String>)module.argMap.get("authz-flag"))
328+
getAuthzFlags((List<String>) module.argMap.get("authz-flag"))
329329
).mput(
330330
Authz.InvokeKeys.QUERY_FILTER,
331331
filter
@@ -395,12 +395,12 @@ Map<String, Object> parse(Map<String, String> substitutions, Properties props, L
395395
parser.parse(actionArgs);
396396
Map<String, Object> argMap = parser.getParsedArgs();
397397

398-
if((Boolean)argMap.get("help")) {
398+
if ((Boolean) argMap.get("help")) {
399399
System.out.format("Usage: %s", parser.getUsage());
400400
throw new ExitException("Help", 0);
401401
}
402-
if(!parser.getErrors().isEmpty()) {
403-
for(Throwable t : parser.getErrors()) {
402+
if (!parser.getErrors().isEmpty()) {
403+
for (Throwable t : parser.getErrors()) {
404404
log.error(t.getMessage());
405405
}
406406
throw new ExitException("Parsing error", 1);
@@ -492,7 +492,7 @@ private static void dumpRecord(AAAServiceImpl module, ExtMap extMap, Set<ExtKey>
492492
Collection<ExtKey> keys = new HashSet<>(extMap.keySet());
493493
if (module.argModuleMap.get("key") != null) {
494494
Collection<ExtKey> k = new HashSet<>();
495-
for (String uuid : (List<String>)module.argModuleMap.get("key")) {
495+
for (String uuid : (List<String>) module.argModuleMap.get("key")) {
496496
k.add(new ExtKey("Unknown", Object.class, uuid));
497497
}
498498
keys.retainAll(k);
@@ -505,7 +505,7 @@ private static void dumpRecord(AAAServiceImpl module, ExtMap extMap, Set<ExtKey>
505505
continue;
506506
}
507507
module.output(
508-
((String)module.argModuleMap.get("format")).replace(
508+
((String) module.argModuleMap.get("format")).replace(
509509
"{key}",
510510
key.getUuid().getUuid().toString()
511511
).replace(
@@ -540,7 +540,7 @@ private static <T> List<T> safeList(List<T> list) {
540540
}
541541

542542
private ExtensionsManager getExtensionsManager() {
543-
return (ExtensionsManager)context.get(ContextKeys.EXTENSION_MANAGER);
543+
return (ExtensionsManager) context.get(ContextKeys.EXTENSION_MANAGER);
544544
}
545545

546546
private ExtensionProxy getExtensionByProfile(String name) {
@@ -554,7 +554,7 @@ private ExtensionProxy getExtensionByProfile(String name) {
554554
private ExtensionProxy getExtensionByConfigKey(String key, String value) {
555555
ExtensionProxy ret = null;
556556

557-
for(ExtensionProxy proxy : getExtensionsManager().getExtensionsByService(Authn.class.getName())) {
557+
for (ExtensionProxy proxy : getExtensionsManager().getExtensionsByService(Authn.class.getName())) {
558558
if (
559559
value.equals(
560560
proxy.getContext().<Properties>get(
@@ -591,7 +591,7 @@ private static String getPassword(String what, String prompt) {
591591
if ("pass".equals(type)) {
592592
password = value;
593593
} else if ("file".equals(type)) {
594-
try(
594+
try (
595595
InputStream is = new FileInputStream(value);
596596
Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8);
597597
BufferedReader breader = new BufferedReader(reader)
@@ -652,12 +652,12 @@ public void parseArguments(List<String> args) throws Exception {
652652
parser.parse(args);
653653
argModuleMap = parser.getParsedArgs();
654654

655-
if((Boolean)argModuleMap.get("help")) {
655+
if ((Boolean) argModuleMap.get("help")) {
656656
System.out.format("Usage: %s", parser.getUsage());
657657
throw new ExitException("Help", 0);
658658
}
659-
if(!parser.getErrors().isEmpty()) {
660-
for(Throwable t : parser.getErrors()) {
659+
if (!parser.getErrors().isEmpty()) {
660+
for (Throwable t : parser.getErrors()) {
661661
log.error(t.getMessage());
662662
}
663663
throw new ExitException("Parsing error", 1);
@@ -670,7 +670,7 @@ public void parseArguments(List<String> args) throws Exception {
670670

671671
try {
672672
action = Action.valueOf(args.get(0).toUpperCase().replace("-", "_"));
673-
} catch(IllegalArgumentException e) {
673+
} catch (IllegalArgumentException e) {
674674
log.error("Invalid action '{}'", args.get(0));
675675
throw new ExitException("Invalid action", 1);
676676
}
@@ -680,7 +680,7 @@ public void parseArguments(List<String> args) throws Exception {
680680

681681
@Override
682682
public void run() throws Exception {
683-
int iterations = (Integer)argModuleMap.get("iterations");
683+
int iterations = (Integer) argModuleMap.get("iterations");
684684
for (int i = 0; i < iterations; i++) {
685685
log.info("Iteration: {}", i);
686686
action.execute(this);
@@ -699,7 +699,7 @@ private static ExtMap createQueryFilter(ExtUUID entity, Map<String, Object> argM
699699
);
700700
}
701701

702-
for (String id : safeList((List<String>)argMap.get("entity-id"))) {
702+
for (String id : safeList((List<String>) argMap.get("entity-id"))) {
703703
filter.add(
704704
createQueryFilterElement(
705705
Authz.QueryEntity.GROUP.equals(entity) ? Authz.GroupRecord.ID : Authz.PrincipalRecord.ID,
@@ -733,7 +733,7 @@ private static ExtMap createQueryFilterElement(ExtKey key, String value) {
733733
);
734734
}
735735

736-
private static ExtUUID getQueryEntity(String entity) {
736+
private static ExtUUID getQueryEntity(String entity) {
737737
try {
738738
return (ExtUUID) Authz.QueryEntity.class.getDeclaredField(
739739
entity.toUpperCase()
@@ -748,7 +748,7 @@ private static int getAuthzFlags(List<String> flags) {
748748
for (String f : safeList(flags)) {
749749
try {
750750
ret |= Authz.QueryFlags.class.getDeclaredField(f.toUpperCase().replace("-", "_")).getInt(new Authz.QueryFlags());
751-
} catch(NoSuchFieldException | IllegalAccessException ex) {
751+
} catch (NoSuchFieldException | IllegalAccessException ex) {
752752
log.error("Unknown Authz flag '{}' (ignored)", f);
753753
}
754754
}
@@ -842,7 +842,7 @@ public AAAProfile(String profile) {
842842
this.authnName = this.authnExtension.getContext().get(Base.ContextKeys.INSTANCE_NAME);
843843

844844
this.authzExtension = getExtensionsManager().getExtensionByName(authzName);
845-
if(this.mappingName != null) {
845+
if (this.mappingName != null) {
846846
this.mappingExtension = getExtensionsManager().getExtensionByName(mappingName);
847847
}
848848

@@ -856,7 +856,7 @@ public AAAProfile(String profile) {
856856
}
857857

858858
public String mapUser(String user) {
859-
if(getMappingExtension()!= null) {
859+
if (getMappingExtension() != null) {
860860
log.info("API: -->Mapping.InvokeCommands.MAP_USER profile='{}' user='{}'", getProfile(), user);
861861
user = getMappingExtension().invoke(
862862
new ExtMap().mput(

backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/core/ExtensionsToolExecutor.java

+15-15
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ public static void main(String... args) {
7878

7979
log.debug("Version: {}-{} ({})", PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_DISPLAY_NAME);
8080

81-
if((Boolean)argMap.get("help")) {
81+
if ((Boolean) argMap.get("help")) {
8282
System.out.format("Usage: %s", parser.getUsage());
8383
throw new ExitException("Help", 0);
84-
} else if((Boolean)argMap.get("version")) {
84+
} else if ((Boolean) argMap.get("version")) {
8585
System.out.format("%s-%s (%s)%n", PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_DISPLAY_NAME);
8686
throw new ExitException("Version", 0);
8787
}
88-
if(!parser.getErrors().isEmpty()) {
89-
for(Throwable t : parser.getErrors()) {
88+
if (!parser.getErrors().isEmpty()) {
89+
for (Throwable t : parser.getErrors()) {
9090
log.error(t.getMessage());
9191
log.debug(t.getMessage(), t);
9292
}
@@ -120,7 +120,7 @@ public static void main(String... args) {
120120
log.info("========================================================================");
121121
moduleService.run();
122122
exitStatus = 0;
123-
} catch(ExitException e) {
123+
} catch (ExitException e) {
124124
log.debug(e.getMessage(), e);
125125
exitStatus = e.getExitCode();
126126
} catch (Throwable t) {
@@ -168,7 +168,7 @@ private static Path createTemporaryJAASconfiguration() throws IOException {
168168
principalName = String.format("principal=\"%s\"", AAA_JAAS_PRINCIPAL_NAME);
169169
}
170170

171-
String debug= "";
171+
String debug = "";
172172
if (StringUtils.isNotEmpty(AAA_JAAS_ENABLE_DEBUG)) {
173173
debug = String.format("debug=\"%s\"", AAA_JAAS_ENABLE_DEBUG);
174174
}
@@ -207,16 +207,16 @@ private static void loadExtensions(
207207
ModuleService moduleService,
208208
Map<String, Object> argMap
209209
) {
210-
List<File> files = (List<File>)argMap.get("extension-file");
211-
if(files == null) {
210+
List<File> files = (List<File>) argMap.get("extension-file");
211+
if (files == null) {
212212
files = listFiles(
213213
(String) argMap.get("extensions-dir"),
214214
"properties"
215215
);
216216
}
217217

218218
List<String> loadedExtensions = new LinkedList<>();
219-
for(File f : files) {
219+
for (File f : files) {
220220
log.debug("Loading extension file '{}'", f.getName());
221221
try {
222222
String name = extensionsManager.load(f);
@@ -231,7 +231,7 @@ private static void loadExtensions(
231231
}
232232
}
233233

234-
for(String extension : loadedExtensions) {
234+
for (String extension : loadedExtensions) {
235235
try {
236236
extensionsManager.initialize(extension);
237237
log.debug("Extension '{}' initialized", extension);
@@ -245,7 +245,7 @@ private static void loadExtensions(
245245

246246
private static Map<String, ModuleService> loadModules(Class cls) {
247247
Map<String, ModuleService> modules = new HashMap<>();
248-
if(cls != null) {
248+
if (cls != null) {
249249
ServiceLoader<ModuleService> loader = ServiceLoader.load(cls);
250250
for (ModuleService module : loader) {
251251
modules.put(module.getName(), module);
@@ -266,14 +266,14 @@ private static void setupLogger() {
266266

267267
private static void setupLogger(Map<String, Object> args) throws IOException {
268268
Logger log = Logger.getLogger("");
269-
String logfile = (String)args.get("log-file");
270-
if(logfile != null) {
269+
String logfile = (String) args.get("log-file");
270+
if (logfile != null) {
271271
FileHandler fh = new FileHandler(logfile, true);
272272
fh.setFormatter(new SimpleFormatter());
273273
log.addHandler(fh);
274274
}
275275

276-
OVIRT_LOGGER.setLevel((Level)args.get("log-level"));
276+
OVIRT_LOGGER.setLevel((Level) args.get("log-level"));
277277
}
278278

279279
private static List<File> listFiles(String directory, String suffix) {
@@ -293,7 +293,7 @@ private static List<File> listFiles(String directory, String suffix) {
293293

294294
private static String getModules(Map<String, ModuleService> modules) {
295295
StringBuilder sb = new StringBuilder();
296-
for(Map.Entry<String, ModuleService> entry : new TreeMap<>(modules).entrySet()) {
296+
for (Map.Entry<String, ModuleService> entry : new TreeMap<>(modules).entrySet()) {
297297
sb.append(
298298
String.format(" %-10s - %s%n", entry.getKey(), entry.getValue().getDescription())
299299
);

backend/manager/extensions-tool/src/main/java/org/ovirt/engine/exttool/core/HelpServiceImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public ExtMap getContext() {
3333
@Override
3434
public void parseArguments(List<String> args) throws Exception {
3535
System.out.println("Available modules:");
36-
for(Map.Entry<String, ModuleService> entry : new TreeMap<>(getContext().<Map<String, ModuleService>>get(ContextKeys.MODULES)).entrySet()) {
36+
for (Map.Entry<String, ModuleService> entry : new TreeMap<>(getContext().<Map<String, ModuleService>>get(ContextKeys.MODULES)).entrySet()) {
3737
System.out.printf(
3838
String.format(" %-10s - %s%n",
3939
entry.getKey(),

0 commit comments

Comments
 (0)