Ensure designate-manage reads config before policy
With the designate-manage command, the policy file is read before the configuration is parsed. If the policy file is in a non-default location, all designate-manage commands would fail. Change-Id: Ic1e37c18cc61732db8df0d59cdb687b0167d63c0 Closes-Bug: 1519356
This commit is contained in:
parent
e5e92222e2
commit
52500ae2e4
@ -19,6 +19,7 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from designate import exceptions
|
||||
from designate import policy
|
||||
from designate import rpc
|
||||
from designate.i18n import _ # noqa
|
||||
from designate.i18n import _LI
|
||||
@ -36,8 +37,6 @@ class AkamaiCommands(base.Commands):
|
||||
rpc.init(cfg.CONF)
|
||||
self.central_api = central_rpcapi.CentralAPI()
|
||||
|
||||
self.context.all_tenants = True
|
||||
|
||||
def _get_config(self, pool_id, target_id):
|
||||
pool = pool_object.Pool.from_config(cfg.CONF, pool_id)
|
||||
target = None
|
||||
@ -61,6 +60,10 @@ class AkamaiCommands(base.Commands):
|
||||
client = impl_akamai.EnhancedDNSClient(
|
||||
target.options.get("username"), target.options.get("password"))
|
||||
|
||||
# Bug 1519356 - Init policy after configuration has been read
|
||||
policy.init()
|
||||
self.context.all_tenants = True
|
||||
|
||||
zone = self.central_api.find_zone(self.context, {"name": zone_name})
|
||||
akamai_zone = client.getZone(zone_name)
|
||||
|
||||
@ -81,6 +84,10 @@ class AkamaiCommands(base.Commands):
|
||||
criterion = {"pool_id": pool_id}
|
||||
marker = None
|
||||
|
||||
# Bug 1519356 - Init policy after configuration has been read
|
||||
policy.init()
|
||||
self.context.all_tenants = True
|
||||
|
||||
while (marker is not False):
|
||||
zones = self.central_api.find_zones(
|
||||
self.context, criterion, limit=batch_size, marker=marker)
|
||||
|
@ -13,7 +13,6 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from designate import policy
|
||||
from designate.context import DesignateContext
|
||||
|
||||
|
||||
@ -39,4 +38,3 @@ class Commands(object):
|
||||
def __init__(self):
|
||||
self.context = DesignateContext.get_admin_context(
|
||||
request_id='designate-manage')
|
||||
policy.init()
|
||||
|
Loading…
x
Reference in New Issue
Block a user