You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by bi...@apache.org on 2014/11/08 02:52:15 UTC
incubator-slider git commit: SLIDER-625 remove broken usage of
CredentialShell and fail fast if specified credentials have not been
pre-initialized
Repository: incubator-slider
Updated Branches:
refs/heads/develop 3fd4225bc -> 1d11d626c
SLIDER-625 remove broken usage of CredentialShell and fail fast if specified credentials have not been pre-initialized
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/1d11d626
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/1d11d626
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/1d11d626
Branch: refs/heads/develop
Commit: 1d11d626cbef0e8cb432a0b8d6ae097ef4877b14
Parents: 3fd4225
Author: Billie Rinaldi <bi...@gmail.com>
Authored: Fri Nov 7 17:51:21 2014 -0800
Committer: Billie Rinaldi <bi...@gmail.com>
Committed: Fri Nov 7 17:51:21 2014 -0800
----------------------------------------------------------------------
.../org/apache/slider/client/SliderClient.java | 25 +++++++-------------
1 file changed, 8 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/1d11d626/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index b9ed2b5..dd8b4db 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -36,7 +36,6 @@ import org.apache.hadoop.registry.client.types.RegistryPathStatus;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.alias.CredentialProvider;
import org.apache.hadoop.security.alias.CredentialProviderFactory;
-import org.apache.hadoop.security.alias.CredentialShell;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
@@ -613,44 +612,36 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe
clustername, clusterDirectory);
try {
checkForCredentials(getConfig(), instanceDefinition.getAppConf());
- } catch (Exception e) {
- throw new IOException("problem setting credentials", e);
+ } catch (IOException e) {
+ sliderFileSystem.getFileSystem().delete(clusterDirectory, true);
+ throw e;
}
return startCluster(clustername, createArgs);
}
private void checkForCredentials(Configuration conf,
- ConfTree tree) throws Exception {
+ ConfTree tree) throws IOException {
if (tree.credentials == null || tree.credentials.size()==0) {
log.info("No credentials requested");
return;
}
- CredentialShell credentialShell = null;
+
for (Entry<String, List<String>> cred : tree.credentials.entrySet()) {
String provider = cred.getKey();
List<String> aliases = cred.getValue();
if (aliases == null || aliases.size()==0) {
continue;
}
- if (credentialShell == null) {
- credentialShell = new CredentialShell();
- credentialShell.setConf(conf);
- }
Configuration c = new Configuration(conf);
c.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, provider);
CredentialProvider credentialProvider =
CredentialProviderFactory.getProviders(c).get(0);
Set<String> existingAliases = new HashSet<String>(credentialProvider.getAliases());
for (String alias : aliases) {
- if (existingAliases.contains(alias.toLowerCase(Locale.ENGLISH))) {
- log.warn("Skipping creation of credentials for {}, " +
- "alias already exists in {}", alias, provider);
- continue;
+ if (!existingAliases.contains(alias.toLowerCase(Locale.ENGLISH))) {
+ throw new IOException("Specified credentials have not been " +
+ "initialized in provider " + provider + ": " + alias);
}
- String[] csarg = new String[]{
- "create", alias, "-provider", provider};
- log.info("Creating credentials for {} in {}", alias, provider);
- credentialShell.run(csarg);
}
}
}