Merge remote-tracking branch 'origin/master' into
fix_introduce_consistent_button_position_in_change_dialogs Conflicts: hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadStatusObject.java Signed-off-by: Melanie Retter <melanie.retter@bosch-si.com>
This commit is contained in:
@@ -134,7 +134,7 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
|
||||
private Action checkAndReportDownloadByTarget(final HttpServletRequest request, final String targetid,
|
||||
final LocalArtifact artifact) {
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid,
|
||||
IpUtil.getClientIpFromRequest(request, securityProperties.getClients().getRemoteIpHeader()));
|
||||
IpUtil.getClientIpFromRequest(request, securityProperties));
|
||||
|
||||
final Action action = controllerManagement
|
||||
.getActionForDownloadByTargetAndSoftwareModule(target.getControllerId(), artifact.getSoftwareModule());
|
||||
|
||||
@@ -119,16 +119,14 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
public ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("targetid") final String targetid) {
|
||||
LOG.debug("getControllerBase({})", targetid);
|
||||
|
||||
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotexist(targetid,
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotexist(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
|
||||
if (target.getTargetInfo().getUpdateStatus() == TargetUpdateStatus.UNKNOWN) {
|
||||
LOG.debug("target with {} extsisted but was in status UNKNOWN -> REGISTERED)", targetid);
|
||||
controllerManagement.updateTargetStatus(target.getTargetInfo(), TargetUpdateStatus.REGISTERED,
|
||||
System.currentTimeMillis(),
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
System.currentTimeMillis(), IpUtil.getClientIpFromRequest(
|
||||
requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(
|
||||
@@ -143,9 +141,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
@PathVariable("fileName") final String fileName) {
|
||||
ResponseEntity<InputStream> result;
|
||||
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid,
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
final SoftwareModule module = softwareManagement.findSoftwareModuleById(softwareModuleId);
|
||||
|
||||
if (checkModule(fileName, module)) {
|
||||
@@ -200,9 +197,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
public ResponseEntity<Void> downloadArtifactMd5(@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("fileName") final String fileName) {
|
||||
controllerManagement.updateLastTargetQuery(targetid,
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
|
||||
final SoftwareModule module = softwareManagement.findSoftwareModuleById(softwareModuleId);
|
||||
|
||||
@@ -228,9 +224,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
@RequestParam(value = "c", required = false, defaultValue = "-1") final int resource) {
|
||||
LOG.debug("getControllerBasedeploymentAction({},{})", targetid, resource);
|
||||
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid,
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
|
||||
final Action action = findActionWithExceptionIfNotFound(actionId);
|
||||
if (!action.getTarget().getId().equals(target.getId())) {
|
||||
@@ -263,9 +258,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
@PathVariable("targetid") final String targetid, @PathVariable("actionId") @NotEmpty final Long actionId) {
|
||||
LOG.debug("provideBasedeploymentActionFeedback for target [{},{}]: {}", targetid, actionId, feedback);
|
||||
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid,
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
|
||||
if (!actionId.equals(feedback.getId())) {
|
||||
LOG.warn(
|
||||
@@ -357,9 +351,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
@Override
|
||||
public ResponseEntity<Void> putConfigData(@Valid @RequestBody final DdiConfigData configData,
|
||||
@PathVariable("targetid") final String targetid) {
|
||||
controllerManagement.updateLastTargetQuery(targetid,
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
|
||||
controllerManagement.updateControllerAttributes(targetid, configData.getData());
|
||||
|
||||
@@ -372,9 +365,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId) {
|
||||
LOG.debug("getControllerCancelAction({})", targetid);
|
||||
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid,
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
|
||||
final Action action = findActionWithExceptionIfNotFound(actionId);
|
||||
if (!action.getTarget().getId().equals(target.getId())) {
|
||||
@@ -403,9 +395,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId) {
|
||||
LOG.debug("provideCancelActionFeedback for target [{}]: {}", targetid, feedback);
|
||||
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid,
|
||||
IpUtil.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(),
|
||||
securityProperties.getClients().getRemoteIpHeader()));
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
|
||||
if (!actionId.equals(feedback.getId())) {
|
||||
LOG.warn(
|
||||
|
||||
@@ -29,11 +29,11 @@ import org.apache.commons.lang3.RandomUtils;
|
||||
import org.eclipse.hawkbit.eventbus.event.DownloadProgressEvent;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTestWithMongoDB;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -28,14 +28,16 @@ import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTestWithMongoDB;
|
||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.eclipse.hawkbit.util.IpUtil;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
@@ -50,6 +52,9 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
@Stories("Root Poll Resource")
|
||||
public class DdiRootControllerTest extends AbstractRestIntegrationTestWithMongoDB {
|
||||
|
||||
@Autowired
|
||||
private HawkbitSecurityProperties securityProperties;
|
||||
|
||||
@Test
|
||||
@Description("Ensures that targets cannot be created e.g. in plug'n play scenarios when tenant does not exists but can be created if the tenant exists.")
|
||||
@WithUser(tenantId = "tenantDoesNotExists", allSpPermissions = true, authorities = "ROLE_CONTROLLER", autoCreateTenant = false)
|
||||
@@ -257,6 +262,23 @@ public class DdiRootControllerTest extends AbstractRestIntegrationTestWithMongoD
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that the source IP address of the polling target is not stored in repository if disabled")
|
||||
public void rootRsIpAddressNotStoredIfDisabled() throws Exception {
|
||||
securityProperties.getClients().setTrackRemoteIp(false);
|
||||
|
||||
// test
|
||||
final String knownControllerId1 = "0815";
|
||||
mvc.perform(get("/{tenant}/controller/v1/{controllerId}", tenantAware.getCurrentTenant(), knownControllerId1))
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||
|
||||
// verify
|
||||
final Target target = targetManagement.findTargetByControllerID(knownControllerId1);
|
||||
assertThat(target.getTargetInfo().getAddress()).isEqualTo(IpUtil.createHttpUri("***"));
|
||||
|
||||
securityProperties.getClients().setTrackRemoteIp(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Controller trys to finish an update process after it has been finished by an error action status.")
|
||||
public void tryToFinishAnUpdateProcessAfterItHasBeenFinished() throws Exception {
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTestWithMongoDB;
|
||||
import org.eclipse.hawkbit.util.IpUtil;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.eclipse.hawkbit.api.UrlProtocol;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTestWithMongoDB;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -29,12 +29,12 @@ import java.util.Set;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
||||
|
||||
@@ -41,8 +41,8 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.util.HashGeneratorUtils;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.HashGeneratorUtils;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTestWithMongoDB;
|
||||
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaTargetInfo;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
47
hawkbit-repository/README.md
Normal file
47
hawkbit-repository/README.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# hawkBit metadata repository
|
||||
|
||||
The repository is in charge for managing the meta data of the update server, e.g. provisioning targets, distribution sets, software modules etc.
|
||||
|
||||
# Build
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ mvn clean install
|
||||
----
|
||||
|
||||
Note, in order to build correctly in your IDE, you have to add ./target/generated-sources/apt to your build path.
|
||||
|
||||
#Concepts
|
||||
|
||||
## Rollout
|
||||
A rollout consists of the distribution set and a target-query-filter which defines the targets to be updated in this rollout. The targets within this filter are split up in configured amount of _Deployment Groups_ at creation time.
|
||||
|
||||
When starting a rollout, for all targets within this rollout deployment actions will be created. The deployment actions of the first group will be started immediately all other deployment actions will be scheduled.
|
||||
|
||||
> Due rollouts might include a large number of targets and deployment group, creation as well as starting a rollout might take some time and therefore the creation and starting of an rollout is executed asynchronously. The creation and starting progress is reflected by the rollout's status attribute
|
||||
|
||||
### Rollout Creation
|
||||
The targets reflected by the target-query-filter is interpreted at creation time. Only targets which have been created at that time are included in the rollout. Targets which are created after the rollout creation will not be included. At rollout creation time all necessary deployment groups containing the targets will be created. Dynamically adding targets to a created or running rollout is currently not supported.
|
||||
|
||||
### Rollout Starting
|
||||
The rollout is using the same concept based on _deployment acionts_ per target. All necessary _deployment acionts_ will be created at starting point but not all _deployment acionts_ will be set to running. Only the _deployment acionts_ of the first _deployment group_ is set to running, all other actions are created in _scheduled_ state.
|
||||
If targets having not finished _deployment actions_ at rollout starting time, these action are tried to cancel (state: canceling). Scheduled actions from another rollout are canceled directly on server side because they were never running before and can be safely canceled.
|
||||
|
||||
>Multiple rollouts can be running at the same time, but if the rollouts effect the same targets they will interfer the targets _deployment actions_ e.g. canceling/cancel already running/scheduled _deployment actions_.
|
||||
|
||||
### Deployment Group Condition/Action
|
||||
#### Success Condition/Action
|
||||
A _success condition_ defines when a deployment group is interpreted as success and triggers the _success action_. E.g. a threshold of successfully updated targets within the group.
|
||||
|
||||
The _success action_ is executed if the _success_condition_ is fullfilled. Currently only the _success action_ starting the next following deployment group is available.
|
||||
|
||||
#### Error Condition/Action
|
||||
A _error condition_ defines when a deployment group is interpreted as failure and triggers the _error action_. E.g. a threshold of update failures of targets within the group.
|
||||
|
||||
The _error action_ is executed if the _error condition_ is fullfilled. Currently only the _error action_ pausing the whole rollout is available, a paused rollout can be resumed by a user.
|
||||
|
||||
### Rollout Scheduler
|
||||
The rollout is managed by a scheduler task which is checking for rollouts in _running_ state. This is done atomic by updating the row in the database, so only the rollouts are checked and processed for the current instance to avoid that multiple instances are processing a rollout.
|
||||
|
||||
>Due the scheduler, it might take some time until a rollouts is processed and switching is state or starting the next deployment group.
|
||||
|
||||
6
hawkbit-repository/hawkbit-repository-api/README.md
Normal file
6
hawkbit-repository/hawkbit-repository-api/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# hawkBit repository API
|
||||
|
||||
API for repository access. Contains:
|
||||
|
||||
- Entity Model
|
||||
- Management service API
|
||||
3
hawkbit-repository/hawkbit-repository-core/README.md
Normal file
3
hawkbit-repository/hawkbit-repository-core/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# hawkBit common implementation
|
||||
|
||||
Core elements that can be used by implementations.
|
||||
@@ -1,47 +1,3 @@
|
||||
# hawkBit metadata repository
|
||||
|
||||
The repository is in charge for managing the meta data of the update server, e.g. provisioning targets, distribution sets, software modules etc.
|
||||
|
||||
# Build
|
||||
|
||||
[indent=0]
|
||||
----
|
||||
$ mvn clean install
|
||||
----
|
||||
|
||||
Note, in order to build correctly in your IDE, you have to add ./target/generated-sources/apt to your build path.
|
||||
|
||||
#Concepts
|
||||
|
||||
## Rollout
|
||||
A rollout consists of the distribution set and a target-query-filter which defines the targets to be updated in this rollout. The targets within this filter are split up in configured amount of _Deployment Groups_ at creation time.
|
||||
|
||||
When starting a rollout, for all targets within this rollout deployment actions will be created. The deployment actions of the first group will be started immediately all other deployment actions will be scheduled.
|
||||
|
||||
> Due rollouts might include a large number of targets and deployment group, creation as well as starting a rollout might take some time and therefore the creation and starting of an rollout is executed asynchronously. The creation and starting progress is reflected by the rollout's status attribute
|
||||
|
||||
### Rollout Creation
|
||||
The targets reflected by the target-query-filter is interpreted at creation time. Only targets which have been created at that time are included in the rollout. Targets which are created after the rollout creation will not be included. At rollout creation time all necessary deployment groups containing the targets will be created. Dynamically adding targets to a created or running rollout is currently not supported.
|
||||
|
||||
### Rollout Starting
|
||||
The rollout is using the same concept based on _deployment acionts_ per target. All necessary _deployment acionts_ will be created at starting point but not all _deployment acionts_ will be set to running. Only the _deployment acionts_ of the first _deployment group_ is set to running, all other actions are created in _scheduled_ state.
|
||||
If targets having not finished _deployment actions_ at rollout starting time, these action are tried to cancel (state: canceling). Scheduled actions from another rollout are canceled directly on server side because they were never running before and can be safely canceled.
|
||||
|
||||
>Multiple rollouts can be running at the same time, but if the rollouts effect the same targets they will interfer the targets _deployment actions_ e.g. canceling/cancel already running/scheduled _deployment actions_.
|
||||
|
||||
### Deployment Group Condition/Action
|
||||
#### Success Condition/Action
|
||||
A _success condition_ defines when a deployment group is interpreted as success and triggers the _success action_. E.g. a threshold of successfully updated targets within the group.
|
||||
|
||||
The _success action_ is executed if the _success_condition_ is fullfilled. Currently only the _success action_ starting the next following deployment group is available.
|
||||
|
||||
#### Error Condition/Action
|
||||
A _error condition_ defines when a deployment group is interpreted as failure and triggers the _error action_. E.g. a threshold of update failures of targets within the group.
|
||||
|
||||
The _error action_ is executed if the _error condition_ is fullfilled. Currently only the _error action_ pausing the whole rollout is available, a paused rollout can be resumed by a user.
|
||||
|
||||
### Rollout Scheduler
|
||||
The rollout is managed by a scheduler task which is checking for rollouts in _running_ state. This is done atomic by updating the row in the database, so only the rollouts are checked and processed for the current instance to avoid that multiple instances are processing a rollout.
|
||||
|
||||
>Due the scheduler, it might take some time until a rollouts is processed and switching is state or starting the next deployment group.
|
||||
# hawkBit JPA implementation
|
||||
|
||||
JPA implementation of the repository. Based on [EclipseLink](http://www.eclipse.org/eclipselink/) and [Spring Data Jpa](http://projects.spring.io/spring-data-jpa/).
|
||||
@@ -12,7 +12,7 @@ import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.data.mongodb.gridfs.GridFsOperations;
|
||||
|
||||
@@ -12,7 +12,7 @@ import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTestWithMongoDB;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
|
||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.util.HashGeneratorUtils;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.HashGeneratorUtils;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
|
||||
@@ -34,12 +34,12 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.fest.assertions.core.Condition;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@@ -37,9 +37,9 @@ import org.eclipse.hawkbit.repository.report.model.DataReportSeries;
|
||||
import org.eclipse.hawkbit.repository.report.model.DataReportSeriesItem;
|
||||
import org.eclipse.hawkbit.repository.report.model.InnerOuterDataReportSeries;
|
||||
import org.eclipse.hawkbit.repository.report.model.SeriesTime;
|
||||
import org.eclipse.hawkbit.repository.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -34,13 +34,13 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorAction
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||
import org.eclipse.hawkbit.repository.util.TestdataFactory;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Description;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.report.model.TenantUsage;
|
||||
import org.eclipse.hawkbit.repository.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithSpringAuthorityRule;
|
||||
import org.junit.Test;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
|
||||
@@ -38,13 +38,13 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetInfo;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetIdName;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetMetadata;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.util.TestdataFactory;
|
||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@@ -16,8 +16,8 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithSpringAuthorityRule;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Slice;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
/**
|
||||
* Repository support for tests.
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -6,7 +6,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.util;
|
||||
package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.rest;
|
||||
|
||||
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTest;
|
||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
|
||||
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
||||
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.rest;
|
||||
|
||||
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTestWithMongoDB;
|
||||
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
||||
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -110,7 +110,7 @@ public class DosFilter extends OncePerRequestFilter {
|
||||
|
||||
boolean processChain;
|
||||
|
||||
final String ip = IpUtil.getClientIpFromRequest(request, forwardHeader).getHost();
|
||||
final String ip = IpUtil.getClientIpFromRequest(request, forwardHeader, true).getHost();
|
||||
if (checkIpFails(ip)) {
|
||||
processChain = handleMissingIpAddress(response);
|
||||
} else {
|
||||
|
||||
@@ -82,10 +82,16 @@ public class HawkbitSecurityProperties {
|
||||
private String blacklist = "";
|
||||
|
||||
/**
|
||||
* Name of the http header from which the remote ip is extracted.
|
||||
* Name of the http header from which the remote ip is extracted for DDI
|
||||
* connected clients.
|
||||
*/
|
||||
private String remoteIpHeader = "X-Forwarded-For";
|
||||
|
||||
/**
|
||||
* Set to <code>true</code> if DDI clients remote IP should be stored.
|
||||
*/
|
||||
private boolean trackRemoteIp = true;
|
||||
|
||||
public String getBlacklist() {
|
||||
return blacklist;
|
||||
}
|
||||
@@ -101,6 +107,14 @@ public class HawkbitSecurityProperties {
|
||||
public void setRemoteIpHeader(final String remoteIpHeader) {
|
||||
this.remoteIpHeader = remoteIpHeader;
|
||||
}
|
||||
|
||||
public boolean isTrackRemoteIp() {
|
||||
return trackRemoteIp;
|
||||
}
|
||||
|
||||
public void setTrackRemoteIp(final boolean trackRemoteIp) {
|
||||
this.trackRemoteIp = trackRemoteIp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||
|
||||
import com.google.common.net.HttpHeaders;
|
||||
|
||||
/**
|
||||
@@ -45,17 +47,49 @@ public final class IpUtil {
|
||||
* @param request
|
||||
* the {@link HttpServletRequest} to determine the IP address
|
||||
* where this request has been sent from
|
||||
* @param forwardHeader
|
||||
* the header name containing the IP address e.g. forwarded by a
|
||||
* proxy {@code x-forwarded-for}
|
||||
* @param securityProperties
|
||||
* hawkBit security properties.
|
||||
* @return the {@link URI} based IP address from the client which sent the
|
||||
* request
|
||||
*/
|
||||
public static URI getClientIpFromRequest(final HttpServletRequest request, final String forwardHeader) {
|
||||
String ip = request.getHeader(forwardHeader);
|
||||
if (ip == null || (ip = findClientIpAddress(ip)) == null) {
|
||||
ip = request.getRemoteAddr();
|
||||
public static URI getClientIpFromRequest(final HttpServletRequest request,
|
||||
final HawkbitSecurityProperties securityProperties) {
|
||||
|
||||
return getClientIpFromRequest(request, securityProperties.getClients().getRemoteIpHeader(),
|
||||
securityProperties.getClients().isTrackRemoteIp());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the string based IP address from a given
|
||||
* {@link HttpServletRequest} by either the
|
||||
* {@link HttpHeaders#X_FORWARDED_FOR} or by the
|
||||
* {@link HttpServletRequest#getRemoteAddr()} methods.
|
||||
*
|
||||
* @param request
|
||||
* the {@link HttpServletRequest} to determine the IP address
|
||||
* where this request has been sent from
|
||||
* @param forwardHeader
|
||||
* the header name containing the IP address e.g. forwarded by a
|
||||
* proxy {@code x-forwarded-for}
|
||||
*
|
||||
* @param trackRemoteIp
|
||||
* to <code>true</code> if remote IP should be tracked.
|
||||
* @return the {@link URI} based IP address from the client which sent the
|
||||
* request
|
||||
*/
|
||||
public static URI getClientIpFromRequest(final HttpServletRequest request, final String forwardHeader,
|
||||
final boolean trackRemoteIp) {
|
||||
String ip;
|
||||
|
||||
if (trackRemoteIp) {
|
||||
ip = request.getHeader(forwardHeader);
|
||||
if (ip == null || (ip = findClientIpAddress(ip)) == null) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
} else {
|
||||
ip = "***";
|
||||
}
|
||||
|
||||
return createHttpUri(ip);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class IpUtilTest {
|
||||
when(requestMock.getRemoteAddr()).thenReturn(knownRemoteClientIP.getHost());
|
||||
|
||||
// test
|
||||
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "bumlux");
|
||||
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "bumlux", true);
|
||||
|
||||
// verify
|
||||
assertThat(remoteAddr).as("The remote address should be as the known client IP address")
|
||||
@@ -59,6 +59,25 @@ public class IpUtilTest {
|
||||
verify(requestMock, times(1)).getRemoteAddr();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests create uri from request with masked IP when IP tracking is disabled")
|
||||
public void maskRemoteAddrIfDisabled() {
|
||||
// known values
|
||||
final URI knownRemoteClientIP = IpUtil.createHttpUri("***");
|
||||
// mock
|
||||
when(requestMock.getHeader(HttpHeaders.X_FORWARDED_FOR)).thenReturn(null);
|
||||
when(requestMock.getRemoteAddr()).thenReturn(knownRemoteClientIP.getHost());
|
||||
|
||||
// test
|
||||
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "bumlux", false);
|
||||
|
||||
// verify
|
||||
assertThat(remoteAddr).as("The remote address should be as the known client IP address")
|
||||
.isEqualTo(knownRemoteClientIP);
|
||||
verify(requestMock, times(0)).getHeader("bumlux");
|
||||
verify(requestMock, times(0)).getRemoteAddr();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests create uri from x forward header")
|
||||
public void getRemoteAddrFromXForwardedForHeader() {
|
||||
@@ -69,7 +88,7 @@ public class IpUtilTest {
|
||||
when(requestMock.getRemoteAddr()).thenReturn(null);
|
||||
|
||||
// test
|
||||
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "X-Forwarded-For");
|
||||
final URI remoteAddr = IpUtil.getClientIpFromRequest(requestMock, "X-Forwarded-For", true);
|
||||
|
||||
// verify
|
||||
assertThat(remoteAddr).as("The remote address should be as the known client IP address")
|
||||
|
||||
@@ -53,70 +53,65 @@ public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializ
|
||||
|
||||
private Set<Long> selectedSoftwareModules = Collections.emptySet();
|
||||
|
||||
private boolean swTypeFilterClosed = Boolean.FALSE;
|
||||
private boolean swTypeFilterClosed;
|
||||
|
||||
private boolean swModuleTableMaximized = Boolean.FALSE;
|
||||
private boolean swModuleTableMaximized;
|
||||
|
||||
private boolean artifactDetailsMaximized = Boolean.FALSE;
|
||||
private boolean artifactDetailsMaximized;
|
||||
|
||||
private final Set<String> selectedDeleteSWModuleTypes = new HashSet<>();
|
||||
|
||||
private boolean noDataAvilableSoftwareModule = Boolean.FALSE;
|
||||
|
||||
private boolean isStatusPopupMinimized = Boolean.FALSE;
|
||||
|
||||
private boolean isUploadCompleted = Boolean.FALSE;
|
||||
|
||||
private boolean noDataAvilableSoftwareModule;
|
||||
|
||||
private boolean statusPopupMinimized;
|
||||
|
||||
private boolean uploadCompleted;
|
||||
|
||||
private List<UploadStatusObject> uploadedFileStatusList = new ArrayList<>();
|
||||
|
||||
|
||||
private final AtomicInteger numberOfFileUploadsExpected = new AtomicInteger();
|
||||
|
||||
private final AtomicInteger numberOfFilesActuallyUpload = new AtomicInteger();
|
||||
|
||||
|
||||
private final AtomicInteger numberOfFileUploadsFailed = new AtomicInteger();
|
||||
|
||||
public AtomicInteger getNumberOfFileUploadsFailed() {
|
||||
return numberOfFileUploadsFailed;
|
||||
}
|
||||
|
||||
|
||||
public AtomicInteger getNumberOfFilesActuallyUpload() {
|
||||
return numberOfFilesActuallyUpload;
|
||||
}
|
||||
|
||||
|
||||
public AtomicInteger getNumberOfFileUploadsExpected() {
|
||||
return numberOfFileUploadsExpected;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<UploadStatusObject> getUploadedFileStatusList() {
|
||||
return uploadedFileStatusList;
|
||||
}
|
||||
|
||||
public void setUploadedFileStatusList(List<UploadStatusObject> uploadedFileStatusList) {
|
||||
|
||||
public void setUploadedFileStatusList(final List<UploadStatusObject> uploadedFileStatusList) {
|
||||
this.uploadedFileStatusList = uploadedFileStatusList;
|
||||
}
|
||||
|
||||
|
||||
public boolean isUploadCompleted() {
|
||||
return isUploadCompleted;
|
||||
}
|
||||
|
||||
public void setUploadCompleted(boolean isUploadCompleted) {
|
||||
this.isUploadCompleted = isUploadCompleted;
|
||||
return uploadCompleted;
|
||||
}
|
||||
|
||||
public void setUploadCompleted(final boolean uploadCompleted) {
|
||||
this.uploadCompleted = uploadCompleted;
|
||||
}
|
||||
|
||||
public void setStatusPopupMinimized(final boolean statusPopupMinimized) {
|
||||
this.statusPopupMinimized = statusPopupMinimized;
|
||||
}
|
||||
|
||||
|
||||
public void setStatusPopupMinimized(boolean isStatusPopupMinimized) {
|
||||
this.isStatusPopupMinimized = isStatusPopupMinimized;
|
||||
}
|
||||
|
||||
public boolean isStatusPopupMinimized() {
|
||||
return isStatusPopupMinimized;
|
||||
}
|
||||
return statusPopupMinimized;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set software.
|
||||
*
|
||||
* @return
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.artifacts.upload;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
/**
|
||||
@@ -16,22 +18,24 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
* popup.
|
||||
*
|
||||
*/
|
||||
public class UploadStatusObject {
|
||||
public class UploadStatusObject implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String status;
|
||||
private Double progress;
|
||||
private String filename;
|
||||
private String reason;
|
||||
private SoftwareModule selectedSoftwareModule;
|
||||
private final SoftwareModule selectedSoftwareModule;
|
||||
|
||||
public UploadStatusObject(final String status, final Double progress, final String fileName, final String reason,
|
||||
final SoftwareModule selectedSoftwareModule) {
|
||||
this(fileName,selectedSoftwareModule);
|
||||
this(fileName, selectedSoftwareModule);
|
||||
this.status = status;
|
||||
this.progress = progress;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public UploadStatusObject(String fileName, SoftwareModule selectedSoftwareModule) {
|
||||
public UploadStatusObject(final String fileName, final SoftwareModule selectedSoftwareModule) {
|
||||
this.filename = fileName;
|
||||
this.selectedSoftwareModule = selectedSoftwareModule;
|
||||
}
|
||||
@@ -44,7 +48,7 @@ public class UploadStatusObject {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
public void setStatus(final String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@@ -52,7 +56,7 @@ public class UploadStatusObject {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(Double progress) {
|
||||
public void setProgress(final Double progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
@@ -60,7 +64,7 @@ public class UploadStatusObject {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
public void setFilename(final String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
@@ -68,19 +72,38 @@ public class UploadStatusObject {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
public void setReason(final String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == null || obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (obj instanceof UploadStatusObject && this.getFilename() == ((UploadStatusObject) obj).getFilename()) {
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((filename == null) ? 0 : filename.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof UploadStatusObject)) {
|
||||
return false;
|
||||
}
|
||||
final UploadStatusObject other = (UploadStatusObject) obj;
|
||||
if (filename == null) {
|
||||
if (other.filename != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!filename.equals(other.filename)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
columnIds.add(FILTER_BUTTON_COLUMN);
|
||||
setVisibleColumns(columnIds.toArray());
|
||||
setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
|
||||
setColumnWidth(FILTER_BUTTON_COLUMN, 137);
|
||||
}
|
||||
|
||||
private Button createFilterButton(final Long id, final String name, final String description, final String color,
|
||||
@@ -179,6 +180,7 @@ public abstract class AbstractFilterButtons extends Table {
|
||||
button.setDescription(name);
|
||||
}
|
||||
button.setData(id == null ? SPUIDefinitions.NO_TAG_BUTTON_ID : itemId);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.decorators;
|
||||
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIButtonDefinitions;
|
||||
|
||||
import com.vaadin.server.Resource;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
@@ -22,16 +20,10 @@ public class SPUITagButtonStyle implements SPUIButtonDecorator {
|
||||
@Override
|
||||
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
|
||||
|
||||
/**
|
||||
* Add ... for long name
|
||||
*/
|
||||
final String buttonCaption = button.getCaption();
|
||||
if (buttonCaption != null && buttonCaption.length() > SPUIButtonDefinitions.BUTTON_CAPTION_LENGTH) {
|
||||
button.setCaption(buttonCaption.substring(0, SPUIButtonDefinitions.BUTTON_CAPTION_LENGTH) + "...");
|
||||
}
|
||||
button.setImmediate(true);
|
||||
button.addStyleName("button-no-border" + " " + ValoTheme.BUTTON_BORDERLESS + " " + ValoTheme.BUTTON_TINY + " "
|
||||
button.addStyleName("generatedColumnPadding button-no-border" + " " + ValoTheme.BUTTON_BORDERLESS + " "
|
||||
+ "button-tag-no-border");
|
||||
|
||||
// Set Style
|
||||
if (null != style) {
|
||||
if (setStyle) {
|
||||
|
||||
@@ -98,7 +98,7 @@ public class BulkUploadHandler extends CustomComponent
|
||||
|
||||
final TargetBulkUpdateWindowLayout targetBulkUpdateWindowLayout;
|
||||
|
||||
private final EntityFactory entityFactory;
|
||||
private transient EntityFactory entityFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -181,4 +181,13 @@
|
||||
visibility: hidden;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.v-button-generatedColumnPadding {
|
||||
height: 28px;
|
||||
padding: 0 6px !important;
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user