[PATCH configure] BZ 788397 - /var/lib/iwhd should not be removed to maintain consistency with mongodb
by Richard Su
https://bugzilla.redhat.com/show_bug.cgi?id=788397
Currently there isn't a way to remove the buckets in iwhd.
Removing /var/lib/iwhd and directories representing the buckets
causes an inconsistency issue.
---
recipes/aeolus/manifests/iwhd.pp | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/recipes/aeolus/manifests/iwhd.pp b/recipes/aeolus/manifests/iwhd.pp
index 43b219b..6ef10f0 100644
--- a/recipes/aeolus/manifests/iwhd.pp
+++ b/recipes/aeolus/manifests/iwhd.pp
@@ -83,13 +83,6 @@ class aeolus::iwhd::disabled {
enable => false,
hasstatus => true}
- if $aeolus_save_data == "false" {
- file { "/var/lib/iwhd":
- ensure => 'absent',
- backup => 'false',
- force => true,
- require => Service['iwhd']}
- }
}
# Create a named bucket in iwhd
--
1.7.7.6
12 years, 3 months
[PATCH] fix for BZ 789163 fix for make coverage to include ALL py files in coverage report added tests to bring back up the test coverage to 99% after the missed files were added back into coverage
by Dan Radez
---
agent/Makefile | 2 +-
agent/src/audrey/__init__.py | 6 +-
agent/src/audrey/csclient/tooling.py | 96 +++++++----------------
agent/tests/__init__.py | 10 +++
agent/tests/agent.py | 2 +-
agent/tests/csclient.py | 140 +++++++++++++++++++++++++---------
agent/tests/user_data.py | 6 +-
7 files changed, 149 insertions(+), 113 deletions(-)
diff --git a/agent/Makefile b/agent/Makefile
index 5a96004..04d8ecf 100644
--- a/agent/Makefile
+++ b/agent/Makefile
@@ -92,6 +92,6 @@ clean:
coverage: src/audrey/agent.py
coverage erase
coverage run test_audrey_agent.py
- coverage report -m test_audrey_agent.py src/audrey/*.py tests/*.py
+ coverage report -m test_audrey_agent.py `find src/audrey/ -name "*.py"` tests/*.py
.PHONY: dist test rpms srpm
diff --git a/agent/src/audrey/__init__.py b/agent/src/audrey/__init__.py
index 545181f..5675487 100644
--- a/agent/src/audrey/__init__.py
+++ b/agent/src/audrey/__init__.py
@@ -72,8 +72,10 @@ class ASError(Exception):
'''
Some sort of error occurred. The exact cause of the error should
have been logged. So, this just indicates that something is wrong.
- when invoked from rc.local we redirect stderr to the log so
+ when invoked without args we redirect stderr to the log so
logging here is not really nessesary
- TODO: Should really have more of these that are more specific to the error.
'''
pass
+
+class ASErrorInvalidTar(ASError):
+ pass
diff --git a/agent/src/audrey/csclient/tooling.py b/agent/src/audrey/csclient/tooling.py
index 0878372..d3b82d8 100644
--- a/agent/src/audrey/csclient/tooling.py
+++ b/agent/src/audrey/csclient/tooling.py
@@ -20,7 +20,8 @@ import os
import logging
import tarfile
-from audrey import ASError
+from audrey import ASError, ASErrorInvalidTar
+from audrey.shell import run_cmd
TOOLING_DIR = '/var/audrey/tooling/'
@@ -46,12 +47,12 @@ class ConfigTooling(object):
def __init__(self, tool_dir=TOOLING_DIR):
'''
Description:
- Set initial state so it can be tracked. Valuable for
- testing and debugging.
+ Set initial state so it can be tracked.
'''
self.tool_dir = tool_dir
- self.user_dir = tool_dir + 'user/'
- self.log = tool_dir + 'log'
+ self.user_dir = os.path.join(tool_dir, 'user')
+ self.audrey_dir = os.path.join(tool_dir, 'AUDREY_TOOLING')
+ self.redhat_dir = os.path.join(tool_dir, 'REDHAT')
self.tarball = ''
# Create the extraction destination
@@ -64,9 +65,6 @@ class ConfigTooling(object):
raise ASError(('Failed to create directory %s. ' + \
'Error: %s') % (self.user_dir, strerror))
- self.ct_logger = logging.getLogger('ConfigTooling')
- self.ct_logger.addHandler(logging.FileHandler(self.log))
-
def __str__(self):
'''
Description:
@@ -76,36 +74,14 @@ class ConfigTooling(object):
return('\n<Instance of: %s\n' \
'\tTooling Dir: %s\n' \
'\tUnpack User Tooling Tarball Dir: %s\n' \
- '\tLog File: %s\n' \
'\ttarball Name: %s\n' \
'eot>' %
(self.__class__.__name__,
str(self.tool_dir),
str(self.user_dir),
- str(self.log),
str(self.tarball),
))
- def log_info(self, log_str):
- '''
- Description:
- Used for logging the commands that have been executed
- along with their output and return codes.
-
- Simply logs the provided input string.
- '''
- self.ct_logger.info(log_str)
-
- def log_error(self, log_str):
- '''
- Description:
- Used for logging errors encountered when attempting to
- execute the service command.
-
- Simply logs the provided input string.
- '''
- self.ct_logger.error(log_str)
-
def invoke_tooling(self, services):
'''
Description:
@@ -131,24 +107,24 @@ class ConfigTooling(object):
cmd = [tooling_path]
cmd_dir = os.path.dirname(tooling_path)
ret = run_cmd(cmd, cmd_dir)
- self.log_info('Execute Tooling command: ' + ' '.join(cmd))
+ logger.info('Execute Tooling command: ' + ' '.join(cmd))
retcode = ret['subproc'].returncode
if retcode == 0:
# Command successed, log the output.
- self.log_info('return code: ' + str(retcode))
- self.log_info('\n\tStart Output of: ' + ' '.join(cmd) + \
+ logger.info('return code: ' + str(retcode))
+ logger.info('\n\tStart Output of: ' + ' '.join(cmd) + \
' >>>\n' + \
str(ret['out']) + \
'\n\t<<< End Output')
else:
# Command failed, log the errors.
- self.log_info('\n\tStart Output of: ' + ' '.join(cmd) + \
+ logger.info('\n\tStart Output of: ' + ' '.join(cmd) + \
' >>>\n' + \
str(ret['out']) + \
'\n\t<<< End Output')
- self.log_error('error code: ' + str(retcode))
- self.log_error('error msg: ' + str(ret['err']))
+ logger.error('error code: ' + str(retcode))
+ logger.error('error msg: ' + str(ret['err']))
# If tooling was provided at the top level only run it once
# for all services listed in the required config params.
@@ -171,28 +147,21 @@ class ConfigTooling(object):
self.tarball = tarball
# Validate the specified tarfile.
- try:
- if not tarfile.is_tarfile(self.tarball):
- # If file exists but is not a tar file force IOError.
- raise IOError
- except IOError, (errno, strerror):
- raise ASError(('File was not found or is not a tar file: %s ' + \
- 'Error: %s %s') % (self.tarball, errno, strerror))
+ if not os.path.exists(self.tarball):
+ raise ASError('File does not exist: %s ' % self.tarball)
+ if not tarfile.is_tarfile(self.tarball):
+ raise ASErrorInvalidTar('File is not a tar file: %s ' % self.tarball)
# Attempt to extract the contents from the specified tarfile.
- #
# If tarfile access or content is bad report to the user to aid
# problem resolution.
try:
tarf = tarfile.open(self.tarball)
tarf.extractall(path=self.user_dir)
tarf.close()
- except IOError, (errno, strerror):
- raise ASError(('Failed to access tar file %s. Error: %s') % \
- (self.tarball, strerror))
# Capture and report errors with the tarfile
except (tarfile.TarError, tarfile.ReadError, tarfile.CompressionError, \
- tarfile.StreamError, tarfile.ExtractError), (strerror):
+ tarfile.StreamError, tarfile.ExtractError, IOError), (strerror):
raise ASError(('Failed to access tar file %s. Error: %s') % \
(self.tarball, strerror))
@@ -242,25 +211,18 @@ class ConfigTooling(object):
return 1 - True if top level tooling found, False otherwise.
return 2 - path to tooling
'''
-
- top_path = self.tool_dir + 'user/start'
- if os.access(top_path, os.X_OK):
- return True, top_path
-
- service_user_path = self.tool_dir + 'user/' + \
- service_name + '/start'
- if os.access(service_user_path, os.X_OK):
- return False, service_user_path
-
- service_redhat_path = self.tool_dir + 'AUDREY_TOOLING/' + \
- service_name + '/start'
- if os.access(service_redhat_path, os.X_OK):
- return False, service_redhat_path
-
- service_redhat_path = self.tool_dir + 'REDHAT/' + \
- service_name + '/start'
- if os.access(service_redhat_path, os.X_OK):
- return False, service_redhat_path
+ # common join
+ service_start = os.path.join(service_name, 'start')
+ # returns, check the paths and return the tuple
+ tooling_paths = [(True, os.path.join(self.user_dir, 'start')),
+ (False,os.path.join(self.user_dir, service_start)),
+ (False, os.path.join(self.audrey_dir, service_start)),
+ (False, os.path.join(self.redhat_dir, service_start)),
+ ]
+
+ for p in tooling_paths:
+ if os.access(p[1], os.X_OK):
+ return p
# No tooling found. Raise an error.
raise ASError(('No configuration tooling found for service: %s') % \
diff --git a/agent/tests/__init__.py b/agent/tests/__init__.py
index e64eb3f..a94b985 100644
--- a/agent/tests/__init__.py
+++ b/agent/tests/__init__.py
@@ -15,3 +15,13 @@
* limitations under the License.
*
'''
+
+import os
+import stat
+
+def _write_file(filepath, content, mode=0664):
+ f = open(filepath, 'w')
+ f.write(content)
+ f.close()
+ # chmod takes 4 digits!
+ os.chmod(filepath, mode)
diff --git a/agent/tests/agent.py b/agent/tests/agent.py
index 0ca549d..de4587a 100644
--- a/agent/tests/agent.py
+++ b/agent/tests/agent.py
@@ -30,7 +30,7 @@ from audrey.agent import main
from audrey.csclient import gen_env
from tests.mocks import CLOUD_INFO_FILE
-from tests.user_data import _write_file
+from tests import _write_file
class TestAudreyAgent(unittest.TestCase):
'''
diff --git a/agent/tests/csclient.py b/agent/tests/csclient.py
index 24b2a13..4538e4a 100644
--- a/agent/tests/csclient.py
+++ b/agent/tests/csclient.py
@@ -16,10 +16,12 @@
*
'''
+import os
+import shutil
import unittest
import base64
-from audrey import ASError
+from audrey import ASError, ASErrorInvalidTar
from audrey.shell import run_cmd
from audrey.csclient.client import CSClient
from audrey.csclient.tooling import ConfigTooling
@@ -28,11 +30,33 @@ from audrey.csclient import parse_provides_params
from audrey.csclient import generate_provides
from tests.mocks import HttpUnitTest
+from tests import _write_file
DUMMY_CS_CONFIG = {'endpoint': 'http://example.com/',
'oauth_key': 'oauthConsumer',
'oauth_secret': 'oauthSecret',}
+DUMMY_NO_SERVICE_CONFIG_DATA = '|service|' + \
+ '|parameters|jon_server_ip&' + base64.b64encode('192.168.1.1') + \
+ '|jon_server_ip_2&' + base64.b64encode('192.168.1.2') + \
+ '|jon_server_ip_3&' + base64.b64encode('192.168.1.3') + \
+ '|service|jon2|'
+
+VALIDATE_NO_SERVICE_CONFIG_DATA = {'AUDREY_VAR_jon_server_ip' : '192.168.1.1',
+ 'AUDREY_VAR_jon_server_ip_2' : '192.168.1.2',
+ 'AUDREY_VAR_jon_server_ip_3' : '192.168.1.3' }
+
+DUMMY_SERVICE_CONFIG_DATA = '|service|jon1' + \
+ '|parameters|jon_server_ip&' + base64.b64encode('192.168.1.1') + \
+ '|jon_server_ip_2&' + base64.b64encode('192.168.1.2') + \
+ '|jon_server_ip_3&' + base64.b64encode('192.168.1.3') + \
+ '|service|jon2|'
+
+VALIDATE_SERVICE_CONFIG_DATA = {'AUDREY_VAR_jon1_jon_server_ip' : '192.168.1.1',
+ 'AUDREY_VAR_jon1_jon_server_ip_2' : '192.168.1.2',
+ 'AUDREY_VAR_jon1_jon_server_ip_3' : '192.168.1.3' }
+
+
class TestAudreyCSClient(unittest.TestCase):
'''
Class for exercising the gets and put to and from the CS
@@ -106,23 +130,87 @@ class TestAudreyCSClient(unittest.TestCase):
'''
self.cs_client._put('http://hostname/raiseException')
-class TestAudreyStartupConfigTooling(unittest.TestCase):
+class TestAudreyAgentConfigTooling(unittest.TestCase):
'''
Make sure all the Config tooling is tested
'''
- def test_is_user_supplied(self):
- ConfigTooling('test_tooling').is_user_supplied()
+ def setUp(self):
+ self.tool_dir=os.path.join(os.path.abspath('.'),'test_tooling')
+ self.csclient=ConfigTooling(self.tool_dir)
- def test_is_rh_supplied(self):
- ConfigTooling('test_tooling').is_rh_supplied()
-
- def test_empty_find_tooling(self):
- self.assertRaises(ASError, ConfigTooling('test_tooling').find_tooling, '')
+ def tearDown(self):
+ if os.path.exists(self.tool_dir):
+ shutil.rmtree(self.tool_dir)
def test_fail_to_create_tooling_dir(self):
self.assertRaises(ASError, ConfigTooling, tool_dir='/not/real/dir')
-class TestAudreyStartupRequiredConfig(unittest.TestCase):
+ ###### Note
+ # the first two are essentially no op
+ # can we remove the code from the agent?
+ def test_is_user_supplied(self):
+ self.csclient.is_user_supplied()
+
+ def test_is_rh_supplied(self):
+ self.csclient.is_rh_supplied()
+ ###### end note
+
+ def test_empty_find_tooling(self):
+ self.assertRaises(ASError, self.csclient.find_tooling, '')
+
+ def test_find_user_tooling(self):
+ start_path = os.path.join(self.csclient.user_dir, 'start')
+ _write_file(start_path, '#!/bin/sh\nexit 0', 0744)
+ self.csclient.find_tooling('')
+
+ def test_find_user_service_tooling(self):
+ service_dir = os.path.join(self.csclient.user_dir, 'test_service')
+ os.mkdir(service_dir)
+ _write_file(os.path.join(service_dir, 'start'), '#!/bin/sh\nexit 0', 0744)
+ self.csclient.find_tooling('test_service')
+
+ def test_find_audrey_service_tooling(self):
+ service_dir = os.path.join(self.csclient.audrey_dir, 'test_service')
+ os.mkdir(self.csclient.audrey_dir)
+ os.mkdir(service_dir)
+ _write_file(os.path.join(service_dir, 'start'), '#!/bin/sh\nexit 0', 0744)
+ self.csclient.find_tooling('test_service')
+
+ def test_find_redhat_service_tooling(self):
+ service_dir = os.path.join(self.csclient.redhat_dir, 'test_service')
+ os.mkdir(self.csclient.redhat_dir)
+ os.mkdir(service_dir)
+ _write_file(os.path.join(service_dir, 'start'), '#!/bin/sh\nexit 0', 0744)
+ self.csclient.find_tooling('test_service')
+
+ def test_missing_file_unpack_tooling(self):
+ self.assertRaises(ASError, self.csclient.unpack_tooling, 'test_tarball')
+
+ def test_invalid_tar_unpack_tooling(self):
+ tar_file = os.path.join(self.csclient.user_dir, 'invalid_tar')
+ _write_file(tar_file, '')
+ self.assertRaises(ASErrorInvalidTar, self.csclient.unpack_tooling, tar_file)
+
+ def test_fail_execution_invoke_tooling(self):
+ start_path = os.path.join(self.csclient.user_dir, 'start')
+ _write_file(start_path, '#!/bin/sh\nexit 1', 0744)
+ services = parse_require_config(DUMMY_NO_SERVICE_CONFIG_DATA)
+ self.csclient.invoke_tooling(services)
+
+ def test_user_invoke_tooling(self):
+ start_path = os.path.join(self.csclient.user_dir, 'start')
+ _write_file(start_path, '#!/bin/sh\nexit 0', 0744)
+ services = parse_require_config(DUMMY_NO_SERVICE_CONFIG_DATA)
+ self.csclient.invoke_tooling(services)
+
+ def test_user_service_invoke_tooling(self):
+ service_dir = os.path.join(self.csclient.user_dir, 'jon1')
+ os.mkdir(service_dir)
+ _write_file(os.path.join(service_dir, 'start'), '#!/bin/sh\necho', 0744)
+ services = parse_require_config(DUMMY_SERVICE_CONFIG_DATA)
+ self.csclient.invoke_tooling(services)
+
+class TestAudreyAgentRequiredConfig(unittest.TestCase):
'''
Class for exercising the parsing of the Required Configs from the CS.
'''
@@ -132,20 +220,8 @@ class TestAudreyStartupRequiredConfig(unittest.TestCase):
Success case:
- Exercise parse_require_config() with valid input
'''
- # Establish valid test data:
-
- src = '|service|jon1' + \
- '|parameters|jon_server_ip&' + base64.b64encode('192.168.1.1') + \
- '|jon_server_ip_2&' + base64.b64encode('192.168.1.2') + \
- '|jon_server_ip_3&' + base64.b64encode('192.168.1.3') + \
- '|service|jon2|'
-
- validation_dict = {'AUDREY_VAR_jon1_jon_server_ip' : '192.168.1.1',
- 'AUDREY_VAR_jon1_jon_server_ip_2' : '192.168.1.2',
- 'AUDREY_VAR_jon1_jon_server_ip_3' : '192.168.1.3' }
-
# Exersise code segment
- services = parse_require_config(src)
+ services = parse_require_config(DUMMY_SERVICE_CONFIG_DATA)
# Validate results
self.assertEqual(services[0].name, 'jon1')
@@ -158,7 +234,7 @@ class TestAudreyStartupRequiredConfig(unittest.TestCase):
cmd = ['/usr/bin/printenv', env_var]
ret = run_cmd(cmd)
self.assertEqual(ret['out'][:-1], \
- validation_dict[env_var])
+ VALIDATE_SERVICE_CONFIG_DATA[env_var])
def test_success_empty_source(self):
'''
@@ -176,17 +252,7 @@ class TestAudreyStartupRequiredConfig(unittest.TestCase):
- Exercise parse_require_config() with valid input
'''
- src = '|service|' + \
- '|parameters|jon_server_ip&' + base64.b64encode('192.168.1.1') + \
- '|jon_server_ip_2&' + base64.b64encode('192.168.1.2') + \
- '|jon_server_ip_3&' + base64.b64encode('192.168.1.3') + \
- '|service|jon2|'
-
- validation_dict = {'AUDREY_VAR_jon_server_ip' : '192.168.1.1',
- 'AUDREY_VAR_jon_server_ip_2' : '192.168.1.2',
- 'AUDREY_VAR_jon_server_ip_3' : '192.168.1.3' }
-
- services = parse_require_config(src)
+ services = parse_require_config(DUMMY_NO_SERVICE_CONFIG_DATA)
self.assertEqual(services[0].name, '')
self.assertEqual(services[1].name, 'jon2')
@@ -197,7 +263,7 @@ class TestAudreyStartupRequiredConfig(unittest.TestCase):
cmd = ['/usr/bin/printenv', env_var]
ret = run_cmd(cmd)
self.assertEqual(ret['out'][:-1], \
- validation_dict[env_var])
+ VALIDATE_NO_SERVICE_CONFIG_DATA[env_var])
def test_failure_no_services_name(self):
'''
@@ -252,7 +318,7 @@ class TestAudreyStartupRequiredConfig(unittest.TestCase):
self.assertRaises(ASError, parse_require_config, src)
-class TestAudreyStartupProvidesParameters(unittest.TestCase):
+class TestAudreyAgentProvidesParameters(unittest.TestCase):
'''
Class for exercising the parsing of the Provides ParametersConfigs
from the CS.
diff --git a/agent/tests/user_data.py b/agent/tests/user_data.py
index 996f6bd..ea88b16 100644
--- a/agent/tests/user_data.py
+++ b/agent/tests/user_data.py
@@ -24,6 +24,7 @@ import audrey.user_data
from audrey import ASError
+from tests import _write_file
from tests.mocks import mock_run_cmd
from tests.mocks import mock_run_cmd_modprobe_floppy_fail
from tests.mocks import mock_run_cmd_mkdir_media_fail
@@ -32,11 +33,6 @@ from tests.mocks import mock_run_cmd_mount_cdrom_fail
from tests.mocks import DUMMY_USER_DATA
from tests.mocks import CLOUD_INFO_FILE
-def _write_file(filepath, cloud):
- f = open(filepath, 'w')
- f.write(cloud)
- f.close()
-
class TestAudreyUserData(unittest.TestCase):
def setUp(self):
audrey.user_data_ec2.EC2_USER_DATA_URL = 'http://169.254.169.254/latest/user-data'
--
1.7.7.6
12 years, 3 months
[PATCH aeolus-conductor] BZ#789102 Default to first catalog of deployable if catalog not set
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/controllers/deployables_controller.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb
index cf5c6b0..4e4404f 100644
--- a/src/app/controllers/deployables_controller.rb
+++ b/src/app/controllers/deployables_controller.rb
@@ -59,7 +59,7 @@ class DeployablesController < ApplicationController
def show
@deployable = Deployable.find(params[:id])
- @catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
+ @catalog = params[:catalog_id].present? ? Catalog.find(params[:catalog_id]) : @deployable.catalogs.first
require_privilege(Privilege::VIEW, @deployable)
save_breadcrumb(polymorphic_path([@catalog, @deployable]), @deployable.name)
@providers = Provider.all
--
1.7.6.4
12 years, 3 months
RFC: #786844 - Detection of deleted instances
by Matt Wagner
Hi all,
I was looking at https://bugzilla.redhat.com/show_bug.cgi?id=786844 and
ended up establishing somewhat of a rambling commentary in the comments.
Basically, the issue is that if you launch an instance in Conductor, and
then go into the cloud provider and *remove* the instance outside of
Conductor, we never pick up any updates on the instance, showing it as
running in perpetuity.
The reason this happens is that we process these updates by retrieving
the list of instances from the provider via Deltacloud, and updating the
status for each of them. But since cloud providers don't report back
deleted instances, they aren't passed to Deltacloud, or, in turn, us.
There are a few possible fixes:
a.) Do nothing, but document that if you remove instances outside of
Conductor, we won't pick up on them. This is a valid course of action, I
think, but probably not the best.
b.) After retrieving the updates, also go through our database and, for
any that weren't in the list of instances, delete them from our
database. This seems extreme, though, if only because I fear what will
happen if there's some transient error.
c.) Add a new instance state, "vanished" or something to that effect,
and update the status to that instead of deleting it. I think this is my
favorite option, but I'm not sure what it actually accomplishes. It
seems like there's still a lot of work we'd want to do around this, such
as some sort of special highlight in the UI, and also making sure that
you're able to delete 'vanished' instances without a problem. (But,
again, there's the issue of what happens if delete an instance because
of a transient error you're not aware of.)
Does anyone else want to weigh in? I'm just worried that we might be
opening a big can of worms here.
-- Matt
12 years, 3 months
[PATCH conductor] BZ787810: Display availability status of providers and realms
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=787810
---
src/app/helpers/provider_realms_helper.rb | 7 ++++++-
src/app/views/provider_realms/_list.html.haml | 1 +
src/app/views/provider_realms/show.html.haml | 5 +++++
.../providers/_provider_availability.html.haml | 4 ++++
src/app/views/providers/edit.html.haml | 1 +
src/app/views/providers/show.html.haml | 1 +
src/config/locales/en.yml | 6 ++++++
7 files changed, 24 insertions(+), 1 deletions(-)
create mode 100644 src/app/views/providers/_provider_availability.html.haml
diff --git a/src/app/helpers/provider_realms_helper.rb b/src/app/helpers/provider_realms_helper.rb
index 5a4151e..9c36f0b 100644
--- a/src/app/helpers/provider_realms_helper.rb
+++ b/src/app/helpers/provider_realms_helper.rb
@@ -16,7 +16,12 @@
module ProviderRealmsHelper
def provider_realms_header
[
- {:name => t("realms.index.realm_name"), :sort_attr => :name}
+ {:name => t("realms.index.realm_name"), :sort_attr => :name},
+ {:name => t("realms.index.realm_availability")}
]
end
+
+ def availability_label(available)
+ available ? t('realms.index.realm_available.true_value') : t('realms.index.realm_available.false_value')
+ end
end
diff --git a/src/app/views/provider_realms/_list.html.haml b/src/app/views/provider_realms/_list.html.haml
index 82d3732..4ac5741 100644
--- a/src/app/views/provider_realms/_list.html.haml
+++ b/src/app/views/provider_realms/_list.html.haml
@@ -21,3 +21,4 @@
= filter_table(provider_realms_header, @realms) do |realm|
%tr{:class => cycle('nostripe','stripe')}
%td= link_to realm.name, provider_realm_path(realm)
+ %td= availability_label(realm.available)
diff --git a/src/app/views/provider_realms/show.html.haml b/src/app/views/provider_realms/show.html.haml
index 041b199..afa895a 100644
--- a/src/app/views/provider_realms/show.html.haml
+++ b/src/app/views/provider_realms/show.html.haml
@@ -2,6 +2,11 @@
%header.admin-page-header
%h1{:class => controller.controller_name}= @realm.name
+- unless @realm.available
+ %section.admin-content-section
+ %header.align-center
+ %h2.disabled= t('realms.show.realm_unavailable', :name => @realm.name)
+
%section.admin-content-section.realm
%header
%h2= t'realms.show.properties'
diff --git a/src/app/views/providers/_provider_availability.html.haml b/src/app/views/providers/_provider_availability.html.haml
new file mode 100644
index 0000000..7969389
--- /dev/null
+++ b/src/app/views/providers/_provider_availability.html.haml
@@ -0,0 +1,4 @@
+- unless @provider.available
+ %section.admin-content-section
+ %header.align-center
+ %h2.disabled= t('providers.edit.provider_unavailable', :name => @provider.name)
diff --git a/src/app/views/providers/edit.html.haml b/src/app/views/providers/edit.html.haml
index 671aace..86d3301 100644
--- a/src/app/views/providers/edit.html.haml
+++ b/src/app/views/providers/edit.html.haml
@@ -1,5 +1,6 @@
= render :partial => 'layouts/admin_nav'
= render :partial => 'section_header'
+= render :partial => 'provider_availability'
- unless @provider.enabled
%section.admin-content-section
diff --git a/src/app/views/providers/show.html.haml b/src/app/views/providers/show.html.haml
index 2a9896e..0bb23ec 100644
--- a/src/app/views/providers/show.html.haml
+++ b/src/app/views/providers/show.html.haml
@@ -1,5 +1,6 @@
= render :partial => 'layouts/admin_nav'
= render :partial => 'section_header'
+= render :partial => 'provider_availability'
%section.admin-content-section.provider
%header
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 822962d..08a69f2 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -528,6 +528,10 @@ en:
index:
realm: Realm
realm_name: Realm Name
+ realm_availability: Available?
+ realm_available:
+ true_value: "Yes"
+ false_value: "No"
tab_captions:
properties: Properties
mapping: Mapping
@@ -553,6 +557,7 @@ en:
properties: Properties
realm_mapping: Realm Mapping
sure_to_delete: Are you sure you want to delete?
+ realm_unavailable: "The realm %{name} is currently not available."
flash:
notice:
added_mapping: "Realm mapping was added."
@@ -969,6 +974,7 @@ en:
toggle_alerts: Toggle Alerts
provider_disabled: "The provider %{name} is currently disabled."
enable_configure_providers: "To enable and configure provider, click the slide switch in the upper-right-hand corner of this window."
+ provider_unavailable: "The provider %{name} is currently not available."
form:
x_deltacloud_provider: "X-Deltacloud-Provider:"
provider_name: "Provider Name:"
--
1.7.6.5
12 years, 3 months
[PATCH conductor] BZ783923 Prevent redisplaying previous filters by backbone when the view is refreshed
by Jirka Tomasek
From: Jiri Tomasek <jtomasek(a)redhat.com>
---
src/app/views/layouts/_tabpanel.html.haml | 5 +++++
src/public/javascripts/application.js | 9 ++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/app/views/layouts/_tabpanel.html.haml b/src/app/views/layouts/_tabpanel.html.haml
index 277ba1c..2c4050b 100644
--- a/src/app/views/layouts/_tabpanel.html.haml
+++ b/src/app/views/layouts/_tabpanel.html.haml
@@ -12,3 +12,8 @@
-#%a.collapse{'href'=>'#'} Collapse
.content.collapsible#tab
= render :partial => @details_tab[:view]
+
+:javascript
+ $("#tab-container-1-nav li a").click(function(){
+ Conductor.tabIsClickedResetFilters = true;
+ });
diff --git a/src/public/javascripts/application.js b/src/public/javascripts/application.js
index 6cef5c2..3d76c90 100644
--- a/src/public/javascripts/application.js
+++ b/src/public/javascripts/application.js
@@ -3,6 +3,8 @@
$.extend(Conductor, {
+ tabIsClickedResetFilters: false,
+
positionFooter: function () {
var $footer = $('footer');
if ($(document.body).height() < $(window).height()) {
@@ -165,7 +167,12 @@ $.extend(Conductor, {
},
urlParams: function() {
- var paramsData = window.location.search.slice(1).split('&');
+ if(Conductor.tabIsClickedResetFilters == false){
+ var paramsData = window.location.search.slice(1).split('&');
+ } else {
+ var paramsData = [];
+ }
+
var params = {};
$.each(paramsData, function(index, value){
var eqSign = value.search('=');
--
1.7.7.6
12 years, 3 months
[PATCH conductor] BZ#773226 Error message while rebooting stopped instances
by Tomas Sedovic
From: Tomas Sedovic <tomas(a)sedovic.cz>
https://bugzilla.redhat.com/show_bug.cgi?id=773226
We do not allow to reboot an instance that's already stopped.
When the user does this (via the Instances filter view in the Monitor section),
we didn't display the correct error message.
---
src/app/controllers/instances_controller.rb | 4 ++--
src/config/locales/en.yml | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index 08ce4f5..7af1669 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -179,8 +179,8 @@ class InstancesController < ApplicationController
end
def multi_reboot
- notices = ""
- errors = ""
+ notices = []
+ errors = []
Instance.find(params[:instance_selected] || []).each do |instance|
begin
require_privilege(Privilege::USE,instance)
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 822962d..88218ee 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -372,6 +372,7 @@ en:
provider_account_quota_too_low: "%{match_provider_account} quota limit too low to launch deployable"
stop_invalid: "stop is an invalid action."
stop_not_be_performed: "stop cannot be performed on this instance."
+ reboot_not_be_performed: "cannot be rebooted because it's not currently running."
must_be_enabled: "%{account_name}: provider must be enabled"
provider_not_available: "%{account_name}: provider is not available"
cannot_destroy: "destroy cannot be performed on this instance."
--
1.7.6.5
12 years, 3 months