Skip to content

Commit

Permalink
fixup! adressing review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Buziuk <ibuziuk@redhat.com>
  • Loading branch information
ibuziuk committed Jan 12, 2023
1 parent a59cc49 commit db249bf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
import javax.inject.Singleton;
import org.eclipse.che.api.user.server.PreferenceManager;
import org.eclipse.che.api.user.server.UserManager;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.NamespaceResolutionContext;
import org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesClientFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Creates {@link Secret} with user preferences. This serves as a way for DevWorkspaces to acquire
Expand All @@ -30,6 +31,7 @@
@Deprecated
@Singleton
public class UserPreferencesConfigurator implements NamespaceConfigurator {
private static final Logger LOG = LoggerFactory.getLogger(UserProfileConfigurator.class);
private static final String USER_PREFERENCES_SECRET_NAME = "user-preferences";
private static final String USER_PREFERENCES_SECRET_MOUNT_PATH = "/config/user/preferences";
private static final int PREFERENCE_NAME_MAX_LENGTH = 253;
Expand All @@ -48,10 +50,11 @@ public UserPreferencesConfigurator(
this.preferenceManager = preferenceManager;
}

/** 'user-preferences' secret is obsolete and not used anymore by DevWorkspaces */
@Override
public void configure(NamespaceResolutionContext namespaceResolutionContext, String namespaceName)
throws InfrastructureException {}
public void configure(
NamespaceResolutionContext namespaceResolutionContext, String namespaceName) {
LOG.debug("'user-preferences' secret is obsolete and not configured anymore for DevWorkspaces");
}

/**
* Some preferences names are not compatible with k8s restrictions on key field in secret. The
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* Copyright (c) 2012-2022 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
Expand Down Expand Up @@ -56,10 +56,6 @@ public PersonalAccountUserManager(
@Override
public User create(User newUser, boolean isTemporary) throws ConflictException, ServerException {
User createdUser = super.create(newUser, isTemporary);

accountManager.create(
new AccountImpl(createdUser.getId(), createdUser.getName(), PERSONAL_ACCOUNT));

return createdUser;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public AccountManager(AccountDao accountDao, EventService eventService) {
* @throws ServerException when any other error occurs during account creating
*/
public void create(Account account) throws ConflictException, ServerException {
requireNonNull(account, "Required non-null account");
throw new ServerException("Account creation is obsolete and not expected to be invoked");
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2021 Red Hat, Inc.
* Copyright (c) 2012-2022 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -17,7 +17,6 @@
import javax.inject.Inject;
import javax.inject.Singleton;
import org.eclipse.che.account.api.AccountManager;
import org.eclipse.che.account.spi.AccountImpl;
import org.eclipse.che.api.core.ConflictException;
import org.eclipse.che.api.core.NotFoundException;
import org.eclipse.che.api.core.ServerException;
Expand All @@ -29,6 +28,7 @@
*
* @author Anton Korneta
*/
@Deprecated
@Singleton
public class CheUserCreator {

Expand All @@ -52,14 +52,5 @@ public void createCheUser() throws ServerException {
} catch (ConflictException ignore) {
}
}

try {
accountManager.getById("che");
} catch (NotFoundException e) {
try {
accountManager.create(new AccountImpl("che", "che", "personal"));
} catch (ConflictException ignore) {
}
}
}
}

0 comments on commit db249bf

Please sign in to comment.