tripleo-common/tripleo_common/arch.py
Tony Breeds fba2902dc6 Default to host CPU architecture if none is supplied
Currently the only way to specify the CPU architecture of the overcloud
images is by setting it in the appropriate yaml file.  This is fine
until you need to install a single package on multiple CPU architectures.
Then you're either going to attempt to build the wrong image type or you
have to edit the yaml files, which makes problems for upgrades.

This change removes the default architecture from the yaml files and
defaults to the appropriate DiB architecture based on running kernel.

This enables builds on multiple CPU architectures from a single
unmodified package

Change-Id: I34f00a30c1e07869243fb95a437e05d6973a97da
2017-08-05 09:11:20 +10:00

35 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Simple routines to map host architectures as expected by various components.
"""
import os
def kernel_arch():
"""Return the kernel arch."""
return os.uname()[4]
def dib_arch():
"""Return the kernel arch or the more appripriate DiB arch."""
return {'x86_64': 'amd64'}.get(kernel_arch(), kernel_arch())
def cirros_arch():
"""Return the kernel arch or the more appripriate cirros arch."""
return {'ppc64le': 'powerpc'}.get(kernel_arch(), kernel_arch())