# See the License for the specific language governing permissions and
# limitations under the License.
from neutronclient.common.utils import str2bool
-
+import numbers
from snaps import file_utils
from snaps.openstack.utils import glance_utils, keystone_utils
"""
self.host = kwargs.get('host')
self.port = kwargs.get('port')
+ if self.port and isinstance(self.port, numbers.Number):
+ self.port = str(self.port)
self.https_host = kwargs.get('https_host', self.host)
self.https_port = kwargs.get('https_port', self.port)
+ if self.https_port and isinstance(self.https_port, numbers.Number):
+ self.https_port = str(self.https_port)
self.ssh_proxy_cmd = kwargs.get('ssh_proxy_cmd')
def get_credentials(os_env_file=None, proxy_settings_str=None,
- ssh_proxy_cmd=None, dev_os_env_file=None):
+ ssh_proxy_cmd=None, dev_os_env_file=None, overrides=None):
"""
Returns the OpenStack credentials object. It first attempts to retrieve
them from a standard OpenStack source file. If that file is None, it will
:param ssh_proxy_cmd: the SSH proxy command for your environment (optional)
:param dev_os_env_file: the YAML file to retrieve both the OS credentials
and proxy settings
+ :param overrides: dict() containing values to override the credentials
+ found and passed in.
:return: the SNAPS credentials object
"""
if os_env_file:
'cacert': config.get('cacert'),
'region_name': config.get('region_name')}
+ if overrides and isinstance(overrides, dict):
+ creds_dict.update(overrides)
+
os_creds = OSCreds(**creds_dict)
logger.info('OS Credentials = %s', os_creds)
return os_creds