Skip to content

Commit

Permalink
Merge pull request #571 from tonytan4ever/maas-rc-broken-deployment-fix
Browse files Browse the repository at this point in the history
Some 1.7.8 checks (nova api) breaks in absence of maasrc file.  This fix
  • Loading branch information
tonytan4ever authored Oct 5, 2018
2 parents 3bb8ab0 + 290e6da commit 26971fa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
15 changes: 12 additions & 3 deletions playbooks/files/rax-maas/plugins/maas_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
from __future__ import print_function

from itertools import chain
import contextlib
import datetime
import errno
Expand Down Expand Up @@ -652,15 +651,25 @@ def get_auth_details(openrc_file=OPENRC, maasrc_file=MAASRC):
)

try:
with open(openrc_file) as openrc, open(maasrc_file) as maasrc:
for line in chain(openrc, maasrc):
with open(openrc_file) as openrc:
for line in openrc:
match = pattern.match(line)
if match is None:
continue
k = match.group('key')
v = match.group('value').strip('"').strip("'")
if k in auth_details and auth_details[k] is None:
auth_details[k] = v
if os.path.exists(maasrc_file):
with open(maasrc_file) as maasrc:
for line in maasrc:
match = pattern.match(line)
if match is None:
continue
k = match.group('key')
v = match.group('value').strip('"').strip("'")
if k in auth_details and auth_details[k] is None:
auth_details[k] = v
except IOError as e:
if e.errno != errno.ENOENT:
status_err(str(e), m_name='maas_keystone')
Expand Down
1 change: 0 additions & 1 deletion playbooks/maas-pre-flight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
- name: Set MaaS product metadata facts
set_fact:
maas_product: "{{ (rendered_maas_metata_test_tmpl | from_yaml).metadata.product }}"
maas_product_version: "{{ (rendered_maas_metata_test_tmpl | from_yaml).metadata.product_version }}"
maas_osa_version: "{{ (rendered_maas_metata_test_tmpl | from_yaml).metadata.osa_version }}"

# For Queens and beyond, use image api version 2 and volume api version 3
Expand Down
4 changes: 4 additions & 0 deletions playbooks/templates/rax-maas/run_plugin_in_rally_venv.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ if [[ -f ~/openrc ]]; then
source ~/openrc
fi

if [[ -f ~/maasrc ]]; then
source ~/maasrc
fi

# NOTE(cloudnull): Hard coded because this was never addressed upstream
export OS_API_INSECURE=True

Expand Down
4 changes: 4 additions & 0 deletions playbooks/templates/rax-maas/run_plugin_in_venv.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ if [[ -f {{ maas_openrc|default('~/openrc') }} ]]; then
source {{ maas_openrc|default('~/openrc') }}
fi

if [[ -f {{ maas_maasrc|default('~/maasrc') }} ]]; then
source {{ maas_maasrc|default('~/maasrc') }}
fi

# NOTE(cloudnull): Hard coded because this was never addressed upstream
export OS_API_INSECURE={{ maas_os_api_insecure|default('True') }}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Some 1.7.8 checks (nova api) breaks in absence of maasrc file. This fix it.

0 comments on commit 26971fa

Please sign in to comment.