def getSettingsInstance(commandArgs):
    """
    Build a settings instance and set the applicable values from the command
    args.
    """
    from caatinga.core.settings import Settings
    settings = Settings()
    settings.loadSettings(commandArgs.config)
    if commandArgs.root:
        settings.root = commandArgs.root
    if commandArgs.hostName:
        settings.hostName = commandArgs.hostName
    if commandArgs.backupLocation:
        settings.backupLocation = commandArgs.backupLocation
    return settings
