final String password = updateUserCredential.get(2); account.removeCredential(clusterName, uid); final DCOSAccount.ClusterCredential credential = new DCOSAccount.ClusterCredential(clusterName, uid, password, null); account.getClusters().add(credential); final DCOSAccount.ClusterCredential credential = new DCOSAccount.ClusterCredential(clusterName, uid, null, serviceKeyFile); account.getClusters().add(credential);
final Set<String> accountClusters = account.getClusters().stream().map(c -> c.getName()) .collect(Collectors.toSet()); accountClusters.removeAll(definedClusters); final List<String> key = Lists.newArrayList(c.getName(), c.getUid()); if (credentials.contains(key)) { problems.addProblem(ERROR, "Account contains duplicate credentials for cluster \"" + c.getName() + "\" and user id \"" + c.getUid() + "\".").setRemediation("Remove the duplicate credentials"); } else { if (Strings.isStringEmpty(c.getPassword()) && Strings.isStringEmpty(c.getServiceKeyFile())) { problems.addProblem(WARNING, "Account has no password or service key. Unless the cluster has security disabled this may be an error") if (!Strings.isStringEmpty(c.getPassword()) && !Strings.isStringEmpty(c.getServiceKeyFile())) { problems.addProblem(ERROR, "Account has both a password and service key") .setRemediation("Remove either the password or service key."); if (!Strings.isStringEmpty(c.getServiceKeyFile())) { String resolvedServiceKey = ValidatingFileReader.contents(problems, c.getServiceKeyFile());
final Set<String> accountClusters = account.getClusters().stream().map(c -> c.getName()) .collect(Collectors.toSet()); accountClusters.removeAll(definedClusters); final List<String> key = Lists.newArrayList(c.getName(), c.getUid()); if (credentials.contains(key)) { problems.addProblem(ERROR, "Account contains duplicate credentials for cluster \"" + c.getName() + "\" and user id \"" + c.getUid() + "\".").setRemediation("Remove the duplicate credentials"); } else { if (Strings.isStringEmpty(c.getPassword()) && Strings.isStringEmpty(c.getServiceKeyFile())) { problems.addProblem(WARNING, "Account has no password or service key. Unless the cluster has security disabled this may be an error") if (!Strings.isStringEmpty(c.getPassword()) && !Strings.isStringEmpty(c.getServiceKeyFile())) { problems.addProblem(ERROR, "Account has both a password and service key") .setRemediation("Remove either the password or service key."); if (!Strings.isStringEmpty(c.getServiceKeyFile())) { String resolvedServiceKey = ValidatingFileReader.contents(problems, c.getServiceKeyFile());
final String password = updateUserCredential.get(2); account.removeCredential(clusterName, uid); final DCOSAccount.ClusterCredential credential = new DCOSAccount.ClusterCredential(clusterName, uid, password, null); account.getClusters().add(credential); final DCOSAccount.ClusterCredential credential = new DCOSAccount.ClusterCredential(clusterName, uid, null, serviceKeyFile); account.getClusters().add(credential);
@Override protected Account buildAccount(String accountName) { DCOSAccount account = (DCOSAccount) new DCOSAccount().setName(accountName); dockerRegistries.forEach(registryName -> account.getDockerRegistries().add(new DockerRegistryReference().setAccountName(registryName))); if (!isNull(serviceKeyFile) && !isNull(password)) { throw new IllegalArgumentException("Only one of --service-key-file or --password may be set"); } account.setClusters(Lists.newArrayList(new ClusterCredential(cluster, uid, password, serviceKeyFile))); return account; }
@Override protected Account buildAccount(String accountName) { DCOSAccount account = (DCOSAccount) new DCOSAccount().setName(accountName); dockerRegistries.forEach(registryName -> account.getDockerRegistries().add(new DockerRegistryReference().setAccountName(registryName))); if (!isNull(serviceKeyFile) && !isNull(password)) { throw new IllegalArgumentException("Only one of --service-key-file or --password may be set"); } account.setClusters(Lists.newArrayList(new ClusterCredential(cluster, uid, password, serviceKeyFile))); return account; }