Skip to content

Commit

Permalink
fix(provider/openstack) - Do not replace security group application w…
Browse files Browse the repository at this point in the history
…hen editing. (#4886)
  • Loading branch information
johnrengelman authored and anotherchrisberry committed Feb 21, 2018
1 parent 0bb815e commit bea57fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ module.exports = angular.module('spinnaker.securityGroup.openstack.create.contro

if ($scope.isNew) {
$scope.securityGroup = openstackSecurityGroupTransformer.constructNewSecurityGroupTemplate();
$scope.securityGroup.application = application.name
initializeCreateMode();
$scope.state.accountsLoaded = true;
}
else {
$scope.securityGroup = openstackSecurityGroupTransformer.prepareForEdit(securityGroup);

var result = namingService.parseServerGroupName($scope.securityGroup.name);
$scope.securityGroup.application = result.application;
$scope.securityGroup.stack = result.stack;
$scope.securityGroup.detail = result.freeFormDetails;
$scope.state.accountsLoaded = true;
Expand All @@ -149,7 +151,7 @@ module.exports = angular.module('spinnaker.securityGroup.openstack.create.contro

this.getName = function() {
var securityGroup = $scope.securityGroup;
var securityGroupName = _.compact([application.name, (securityGroup.stack), (securityGroup.detail)]).join('-');
var securityGroupName = _.compact([securityGroup.application, (securityGroup.stack), (securityGroup.detail)]).join('-');
return _.trimEnd(securityGroupName, '-');
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ describe('Controller: openstackCreateSecurityGroupCtrl', function() {
};

this.testEditData = {
account: undefined, region: 'region1', name: 'sc111', edit: true, rules: [ ], accountName: undefined, description: undefined, detail: '', stack: ''
account: undefined, region: 'region1', name: 'sc111', edit: true, rules: [ ], accountName: undefined, description: undefined, application: 'sc111', detail: '', stack: ''
};


this.securityGroupDefaults = {
provider: 'openstack', region: '', stack: '', description: '', detail: '', account: 'account1', rules: []
provider: 'openstack', region: '', application: 'app', stack: '', description: '', detail: '', account: 'account1', rules: []
};

this.$scope = $rootScope.$new();
Expand Down Expand Up @@ -94,7 +94,6 @@ describe('Controller: openstackCreateSecurityGroupCtrl', function() {
$state: this.mockState,
application: this.mockApplication,
securityGroup: securityGroup ,
isNew: securityGroup,
securityGroupReader: this.mockSecurityGroupReader,
accountService: this.mockAccountService,
securityGroupWriter: this.mockSecurityGroupWriter,
Expand Down

0 comments on commit bea57fe

Please sign in to comment.