Search in sources :

Example 1 with PropertyPage

use of models.properties.PropertyPage in project coprhd-controller by CoprHD.

the class ConfigProperties method saveProperties.

public static void saveProperties() {
    Map<String, String> properties = params.allSimple();
    for (Entry<String, String> entry : properties.entrySet()) {
        entry.setValue(StringUtils.trim(entry.getValue()));
    }
    List<PropertyPage> pages = loadPropertyPages();
    for (PropertyPage page : pages) {
        page.validate(properties);
    }
    boolean rebootRequired = false;
    Map<String, String> updated = Maps.newHashMap();
    for (PropertyPage page : pages) {
        Map<String, String> pageUpdates = page.getUpdatedValues(properties);
        updated.putAll(pageUpdates);
        // Update the reboot required flag based on the values set for this page
        rebootRequired |= page.isRebootRequired(pageUpdates.keySet());
    }
    if (validation.hasErrors()) {
        flash.error(MessagesUtils.get("configProperties.error.validationError"));
        handleError(updated);
    } else if (!Common.isClusterStable()) {
        flash.error(MessagesUtils.get("configProperties.error.clusterNotStable"));
        handleError(updated);
    } else {
        if (!updated.isEmpty()) {
            // If reboot is required, submit as a job and go to maintenance page. The cluster reboots immediately
            if (rebootRequired) {
                try {
                    ConfigPropertyUtils.saveProperties(updated);
                    flash.success(MessagesUtils.get("configProperties.submittedReboot"));
                    Maintenance.maintenance(Common.reverseRoute(ConfigProperties.class, "properties"));
                } catch (Exception e) {
                    Logger.error("reboot exception - ", e);
                    flashException(e);
                    handleError(updated);
                }
            }
            try {
                ConfigPropertyUtils.saveProperties(updated);
                flash.success(MessagesUtils.get("configProperties.saved"));
            } catch (Exception e) {
                flashException(e);
                handleError(updated);
            }
        }
        properties();
    }
}
Also used : SecurityPropertyPage(models.properties.SecurityPropertyPage) SupportPropertyPage(models.properties.SupportPropertyPage) NetworkPropertyPage(models.properties.NetworkPropertyPage) PropertyPage(models.properties.PropertyPage) ControllerPropertyPage(models.properties.ControllerPropertyPage) SmtpPropertyPage(models.properties.SmtpPropertyPage) PasswordPropertyPage(models.properties.PasswordPropertyPage) DiscoveryPropertyPage(models.properties.DiscoveryPropertyPage) DefaultPropertyPage(models.properties.DefaultPropertyPage) BackupPropertyPage(models.properties.BackupPropertyPage) UpgradePropertyPage(models.properties.UpgradePropertyPage) Common.flashException(controllers.Common.flashException) AuthenticationException(org.apache.http.auth.AuthenticationException) ConnectException(java.net.ConnectException)

Example 2 with PropertyPage

use of models.properties.PropertyPage in project coprhd-controller by CoprHD.

the class ConfigProperties method loadPropertyPages.

private static List<PropertyPage> loadPropertyPages() {
    boolean isActiveSite = DisasterRecoveryUtils.isActiveSite();
    Map<String, Property> properties = loadProperties();
    Map<String, PropertyPage> pages = Maps.newLinkedHashMap();
    Map<String, PropertyPage> excludePages = Maps.newLinkedHashMap();
    if (isActiveSite) {
        addPage(pages, new NetworkPropertyPage(properties));
        if (PlatformUtils.isAppliance()) {
            // This done to maintain the current tab order
            addPage(pages, new SecurityPropertyPage(properties));
        }
        addPage(pages, new ControllerPropertyPage(properties));
        addPage(pages, new DiscoveryPropertyPage(properties));
        if (!SetupUtils.isOssBuild()) {
            addPage(pages, new SupportPropertyPage(properties));
        }
        addPage(pages, new SmtpPropertyPage(properties));
        addPage(pages, new UpgradePropertyPage(properties));
        addPage(pages, new PasswordPropertyPage(properties));
        addPage(pages, new SyslogPropertiesPage(properties));
        addPage(pages, new BackupPropertyPage(properties));
    } else {
        if (PlatformUtils.isAppliance()) {
            addPage(pages, new SecurityPropertyPage(properties));
        }
        addPage(excludePages, new NetworkPropertyPage(properties));
        addPage(excludePages, new ControllerPropertyPage(properties));
        addPage(excludePages, new DiscoveryPropertyPage(properties));
        addPage(excludePages, new SupportPropertyPage(properties));
        addPage(excludePages, new SmtpPropertyPage(properties));
        addPage(excludePages, new UpgradePropertyPage(properties));
        addPage(excludePages, new DefaultPropertyPage(OTHER));
        addPage(excludePages, new PasswordPropertyPage(properties));
        addPage(excludePages, new SyslogPropertiesPage(properties));
        addPage(excludePages, new BackupPropertyPage(properties));
    }
    addDefaultPages(pages, properties.values(), excludePages, isActiveSite);
    return Lists.newArrayList(pages.values());
}
Also used : PasswordPropertyPage(models.properties.PasswordPropertyPage) SecurityPropertyPage(models.properties.SecurityPropertyPage) ControllerPropertyPage(models.properties.ControllerPropertyPage) SecurityPropertyPage(models.properties.SecurityPropertyPage) SupportPropertyPage(models.properties.SupportPropertyPage) NetworkPropertyPage(models.properties.NetworkPropertyPage) PropertyPage(models.properties.PropertyPage) ControllerPropertyPage(models.properties.ControllerPropertyPage) SmtpPropertyPage(models.properties.SmtpPropertyPage) PasswordPropertyPage(models.properties.PasswordPropertyPage) DiscoveryPropertyPage(models.properties.DiscoveryPropertyPage) DefaultPropertyPage(models.properties.DefaultPropertyPage) BackupPropertyPage(models.properties.BackupPropertyPage) UpgradePropertyPage(models.properties.UpgradePropertyPage) SupportPropertyPage(models.properties.SupportPropertyPage) DiscoveryPropertyPage(models.properties.DiscoveryPropertyPage) UpgradePropertyPage(models.properties.UpgradePropertyPage) SyslogPropertiesPage(models.properties.SyslogPropertiesPage) BackupPropertyPage(models.properties.BackupPropertyPage) SmtpPropertyPage(models.properties.SmtpPropertyPage) DefaultPropertyPage(models.properties.DefaultPropertyPage) NetworkPropertyPage(models.properties.NetworkPropertyPage) Property(models.properties.Property)

Example 3 with PropertyPage

use of models.properties.PropertyPage in project coprhd-controller by CoprHD.

the class ConfigProperties method addDefaultPages.

private static void addDefaultPages(Map<String, PropertyPage> pages, Collection<Property> properties, Map<String, PropertyPage> excludePages, boolean isActiveSite) {
    for (Property property : properties) {
        String pageName = StringUtils.defaultIfBlank(property.getPageName(), DEFAULT_PAGE);
        PropertyPage page = pages.get(pageName);
        if (excludePages.get(pageName) == null) {
            if (page == null) {
                page = addPage(pages, new DefaultPropertyPage(pageName));
            }
            if (isActiveSite) {
                page.getProperties().add(property);
            } else {
                String propertyName = StringUtils.defaultIfBlank(property.getName(), DEFAULT_PAGE);
                if (StringUtils.equals(propertyName, PERMIT_ROOT_CONSOLE) || StringUtils.equals(propertyName, PERMIT_ROOT_SSH)) {
                    if (!StringUtils.equals(pageName, SECURITY_PAGE)) {
                        page.getProperties().add(property);
                    }
                } else {
                    page.getProperties().add(property);
                }
            }
        }
    }
}
Also used : SecurityPropertyPage(models.properties.SecurityPropertyPage) SupportPropertyPage(models.properties.SupportPropertyPage) NetworkPropertyPage(models.properties.NetworkPropertyPage) PropertyPage(models.properties.PropertyPage) ControllerPropertyPage(models.properties.ControllerPropertyPage) SmtpPropertyPage(models.properties.SmtpPropertyPage) PasswordPropertyPage(models.properties.PasswordPropertyPage) DiscoveryPropertyPage(models.properties.DiscoveryPropertyPage) DefaultPropertyPage(models.properties.DefaultPropertyPage) BackupPropertyPage(models.properties.BackupPropertyPage) UpgradePropertyPage(models.properties.UpgradePropertyPage) DefaultPropertyPage(models.properties.DefaultPropertyPage) Property(models.properties.Property)

Example 4 with PropertyPage

use of models.properties.PropertyPage in project coprhd-controller by CoprHD.

the class ConfigProperties method properties.

public static void properties() {
    ClusterInfo clusterInfo = Common.getClusterInfoWithRoleCheck();
    List<PropertyPage> pages = loadPropertyPages();
    render(pages, clusterInfo);
}
Also used : ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) SecurityPropertyPage(models.properties.SecurityPropertyPage) SupportPropertyPage(models.properties.SupportPropertyPage) NetworkPropertyPage(models.properties.NetworkPropertyPage) PropertyPage(models.properties.PropertyPage) ControllerPropertyPage(models.properties.ControllerPropertyPage) SmtpPropertyPage(models.properties.SmtpPropertyPage) PasswordPropertyPage(models.properties.PasswordPropertyPage) DiscoveryPropertyPage(models.properties.DiscoveryPropertyPage) DefaultPropertyPage(models.properties.DefaultPropertyPage) BackupPropertyPage(models.properties.BackupPropertyPage) UpgradePropertyPage(models.properties.UpgradePropertyPage)

Aggregations

BackupPropertyPage (models.properties.BackupPropertyPage)4 ControllerPropertyPage (models.properties.ControllerPropertyPage)4 DefaultPropertyPage (models.properties.DefaultPropertyPage)4 DiscoveryPropertyPage (models.properties.DiscoveryPropertyPage)4 NetworkPropertyPage (models.properties.NetworkPropertyPage)4 PasswordPropertyPage (models.properties.PasswordPropertyPage)4 PropertyPage (models.properties.PropertyPage)4 SecurityPropertyPage (models.properties.SecurityPropertyPage)4 SmtpPropertyPage (models.properties.SmtpPropertyPage)4 SupportPropertyPage (models.properties.SupportPropertyPage)4 UpgradePropertyPage (models.properties.UpgradePropertyPage)4 Property (models.properties.Property)2 ClusterInfo (com.emc.vipr.model.sys.ClusterInfo)1 Common.flashException (controllers.Common.flashException)1 ConnectException (java.net.ConnectException)1 SyslogPropertiesPage (models.properties.SyslogPropertiesPage)1 AuthenticationException (org.apache.http.auth.AuthenticationException)1