remove unneeded code that prevented us from removing a single registry

rancher/rancher#16767
This commit is contained in:
Westly Wright 2018-12-11 16:03:11 -07:00
parent b553b47cc5
commit 67cf755eac
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
2 changed files with 9 additions and 20 deletions

View File

@ -587,36 +587,23 @@ export default InputTextFile.extend(ClusterDriver, {
experimentalVersion: C.EXPERIMENTAL_VERSIONS.RKE_K8S,
willSave() {
if ( get(this, 'registry') === 'custom' ) {
const registry = {
url: get(this, 'registryUrl'),
user: get(this, 'registryUser'),
password: get(this, 'registryPass'),
}
set(this, 'config.privateRegistries', [registry]);
}
return this._super(...arguments);
},
validate() {
this._super(...arguments);
let errors = get(this, 'errors') || [];
let config = get(this, `primaryResource.${ this.configField }`);
if ( !get(this, 'isCustom') ) {
errors.pushObjects(get(this, 'nodePoolErrors'));
}
if ( get(this, 'config.services.kubeApi.podSecurityPolicy') &&
if ( get(config, 'services.kubeApi.podSecurityPolicy') &&
!get(this, 'cluster.defaultPodSecurityPolicyTemplateId') ) {
errors.push(get(this, 'intl').t('clusterNew.psp.required'));
}
if (get(this, 'config.privateRegistries.length') >= 1) {
let hasDefault = get(this, 'config.privateRegistries').findBy('isDefault') || false;
if (get(config, 'privateRegistries.length') >= 1) {
let hasDefault = get(config, 'privateRegistries').findBy('isDefault') || false;
if (!hasDefault) {
errors.push(get(this, 'intl').t('cruPrivateRegistry.defaultError'));
@ -629,11 +616,11 @@ export default InputTextFile.extend(ClusterDriver, {
const clusterOptErrors = get(this, 'clusterOptErrors') || [];
if ( get(this, 'config.cloudProvider.name') === 'azure' ) {
if ( get(config, 'cloudProvider.name') === 'azure' ) {
const intl = get(this, 'intl');
Object.keys(AzureInfo).forEach((key) => {
if ( get(AzureInfo, `${ key }.required`) && !get(this, `config.cloudProvider.azureCloudProvider.${ key }`) ) {
if ( get(AzureInfo, `${ key }.required`) && !get(config, `cloudProvider.azureCloudProvider.${ key }`) ) {
errors.push(intl.t('validation.required', { key }));
}
});

View File

@ -69,7 +69,9 @@ export default Component.extend({
}
},
removeRegistry(registry) {
get(this, 'privateRegistries').removeObject(registry);
let { privateRegistries } = this;
set(this, 'config.privateRegistries', privateRegistries.removeObject(registry));
},
},