Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHE-22: check environment parameter on workspace start #518

Merged
merged 1 commit into from
Feb 29, 2016
Merged

Conversation

garagatyi
Copy link

Signed-off-by: Alexander Garagatyi agaragatyi@codenvy.com

@skabashnyuk @evoevodin Please review.

@skabashnyuk
Copy link
Contributor

ок

@@ -30,7 +30,7 @@
@Singleton
public class DefaultWorkspaceConfigValidator implements WorkspaceConfigValidator {
/* should contain [3, 20] characters, first and last character is letter or digit, available characters {A-Za-z0-9.-_}*/
private static final Pattern WS_NAME = Pattern.compile("[\\w][\\w\\.\\-]{1,18}[\\w]");
private static final Pattern WS_NAME = Pattern.compile("[a-zA-Z0-9][-a-zA-Z0-9.]{1,18}[a-zA-Z0-9]");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You made a small mistake here as \\w includes underscore _ as well, so the second [-a-zA-Z0-9.] should include underscore.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, 10x

@garagatyi garagatyi force-pushed the CHE-22 branch 3 times, most recently from 10e4f9e to 166c2f5 Compare February 26, 2016 16:11
@garagatyi
Copy link
Author

@skabashnyuk @evoevodin I reworked the PR. Please take a look.

@skabashnyuk
Copy link
Contributor

ok

@@ -588,6 +592,19 @@ UsersWorkspaceImpl performAsyncStart(UsersWorkspaceImpl workspace,
}
workspace.setTemporary(false);
workspace.setStatus(WorkspaceStatus.STARTING);

if (envName != null && !workspace.getConfig()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that it is the same but shorter

!workspace.getConfig()
          .getEnvironments()
          .stream()
          .anyMatch(env -> env.getName().equals(envName);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lokks better, thanks

@voievodin
Copy link
Contributor

ok

@garagatyi garagatyi force-pushed the CHE-22 branch 3 times, most recently from 3015466 to 2986552 Compare February 29, 2016 08:27
Signed-off-by: Alexander Garagatyi <agaragatyi@codenvy.com>
garagatyi pushed a commit that referenced this pull request Feb 29, 2016
CHE-22: check environment parameter on workspace start
@garagatyi garagatyi merged commit 5dad4fe into master Feb 29, 2016
@garagatyi garagatyi deleted the CHE-22 branch February 29, 2016 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants