forked from openstack/charm-swift-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve links before using path as block device
If the charm code is passed symlinks to block devices (as is often the case with newer MAAS substrate versions), resolve links before attempting to use the block device for storage. Charmhelpers were updated as well. Testing done: - Unit tests pass - Tests pass - Multiple Openstack Autopilot deployments pass Change-Id: If966239502d0752c86e46f3f0aee96f43828aa08 Closes-Bug: 1577408 Signed-off-by: Chris Glass <[email protected]>
- Loading branch information
Chris Glass
committed
May 6, 2016
1 parent
0f912d9
commit 30c3fb9
Showing
5 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
charmhelpers/contrib/openstack/templates/section-keystone-authtoken-mitaka
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% if auth_host -%} | ||
[keystone_authtoken] | ||
auth_uri = {{ service_protocol }}://{{ service_host }}:{{ service_port }} | ||
auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }} | ||
auth_type = password | ||
project_domain_name = default | ||
user_domain_name = default | ||
project_name = {{ admin_tenant_name }} | ||
username = {{ admin_user }} | ||
password = {{ admin_password }} | ||
signing_dir = {{ signing_dir }} | ||
{% endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
import tempfile | ||
import unittest | ||
import shutil | ||
|
||
from mock import patch | ||
|
||
from lib.misc_utils import ensure_block_device | ||
|
||
|
||
class EnsureBlockDeviceTestCase(unittest.TestCase): | ||
|
||
@patch("lib.misc_utils.is_block_device") | ||
def test_symlinks_are_resolved(self, mock_function): | ||
""" | ||
Ensure symlinks pointing to block devices are resolved when passed to | ||
ensure_block_device. | ||
""" | ||
# Create a temporary symlink pointing to /dev/null | ||
temp_dir = tempfile.mkdtemp() | ||
link_path = os.path.join(temp_dir, "null_link") | ||
os.symlink("/dev/null", link_path) | ||
result = ensure_block_device(link_path) | ||
assert mock_function.called | ||
self.assertEqual("/dev/null", result) | ||
shutil.rmtree(temp_dir) |