diff options
author | Christian Schwede <cschwede@redhat.com> | 2016-07-20 09:51:24 +0000 |
---|---|---|
committer | Thiago da Silva <thiago@redhat.com> | 2017-07-12 16:23:04 -0400 |
commit | 2410b616bba2d68914c2c00e95b2f7c30f391e1b (patch) | |
tree | 95928eed905820b5370e2ffec3d5fb5c32780630 /bin | |
parent | 4cb76a41ce0562a458154be1628b33688a0df802 (diff) | |
download | swift-2410b616bba2d68914c2c00e95b2f7c30f391e1b.tar.gz |
Fix swiftdir option and usage of storage policy aliases
If swift-recon/swift-get-nodes/swift-object-info is used with the
swiftdir option they will read rings from the given directory; however
they are still using /etc/swift/swift.conf to find the policies on the
current node.
This makes it impossible to maintain a local swift.conf copy (if you
don't have write access to /etc/swift) or check multiple clusters from
the same node.
Until now swift-recon was also not usable with storage policy aliases,
this patch fixes this as well.
Closes-Bug: 1577582
Closes-Bug: 1604707
Closes-Bug: 1617951
Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>
Co-Authored-By: Thiago da Silva <thiago@redhat.com>
Change-Id: I13188d42ec19e32e4420739eacd1e5b454af2ae3
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/swift-get-nodes | 6 | ||||
-rwxr-xr-x | bin/swift-object-info | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/bin/swift-get-nodes b/bin/swift-get-nodes index e1744274f..3d944bf56 100755 --- a/bin/swift-get-nodes +++ b/bin/swift-get-nodes @@ -19,6 +19,8 @@ from optparse import OptionParser from os.path import basename from swift.common.ring import Ring +from swift.common.storage_policy import reload_storage_policies +from swift.common.utils import set_swift_dir from swift.cli.info import (parse_get_node_args, print_item_locations, InfoSystemExit) @@ -51,6 +53,10 @@ if __name__ == '__main__': parser.add_option('-d', '--swift-dir', default='/etc/swift', dest='swift_dir', help='Path to swift directory') options, args = parser.parse_args() + + if set_swift_dir(options.swift_dir): + reload_storage_policies() + try: ring_path, args = parse_get_node_args(options, args) except InfoSystemExit as e: diff --git a/bin/swift-object-info b/bin/swift-object-info index c625b47bb..fc8a13e4b 100755 --- a/bin/swift-object-info +++ b/bin/swift-object-info @@ -17,6 +17,8 @@ import sys from optparse import OptionParser +from swift.common.storage_policy import reload_storage_policies +from swift.common.utils import set_swift_dir from swift.cli.info import print_obj, InfoSystemExit @@ -38,6 +40,9 @@ if __name__ == '__main__': if len(args) != 1: sys.exit(parser.print_help()) + if set_swift_dir(options.swift_dir): + reload_storage_policies() + try: print_obj(*args, **vars(options)) except InfoSystemExit: |