Skip to content

Commit

Permalink
Docker volumes should not trigger warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierluigi Cau committed Apr 18, 2016
1 parent 30e83cd commit 0aa186f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Unversioned
### Fixed
- \#3790 - Remove Docker on submit if no image is provided
- \#3794 - Applications with Docker volumes are mistakenly treated as stateful
applications

## 1.1.2 - 2016-04-14
### Fixed
Expand Down
15 changes: 9 additions & 6 deletions src/js/mixins/AppActionsHandlerMixin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ var callErrorDialog = function (settings) {
});
};

var isStatefulApp = function (app) {
return app.container != null &&
app.container.volumes != null &&
app.container.volumes
.some(volume => volume.persistent != null || volume.external != null);
};

var AppActionsHandlerMixin = {
componentWillMount: function () {
if (this.props.model == null) {
Expand Down Expand Up @@ -197,9 +204,7 @@ var AppActionsHandlerMixin = {
if (instancesString != null && instancesString !== "") {
let instances = parseInt(instancesString, 10);

if (model.container != null && model.container.volumes != null &&
model.instances > instances
) {
if (isStatefulApp(model) && model.instances > instances) {
this.handleScaleDownVolumeApp(instances);
return;
}
Expand Down Expand Up @@ -293,9 +298,7 @@ var AppActionsHandlerMixin = {
});

DialogStore.handleUserResponse(dialogId, () => {
if (model.container != null &&
model.container.volumes != null &&
model.container.volumes.length > 0) {
if (isStatefulApp(model) && model.instances > instances) {
this.handleScaleDownVolumeApp(0);
return;
}
Expand Down

0 comments on commit 0aa186f

Please sign in to comment.