You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2019/03/13 09:55:40 UTC

[cloudstack-cloudmonkey] branch master updated: config: Fix prompt to use the same profile name as loaded

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git


The following commit(s) were added to refs/heads/master by this push:
     new 6544270  config: Fix prompt to use the same profile name as loaded
6544270 is described below

commit 654427004dba7f647db3db35ef97aee70efdbf42
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Wed Mar 13 15:24:23 2019 +0530

    config: Fix prompt to use the same profile name as loaded
    
    When -p <profilename> is passed via cmd line, cloudmonkey indeed uses
    the correctly passed profile name but in shell/interactive mode it
    does not print it correctly.
    
    Fixes #47
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 config/config.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/config/config.go b/config/config.go
index d1ae6b0..7485d85 100644
--- a/config/config.go
+++ b/config/config.go
@@ -259,6 +259,7 @@ func saveConfig(cfg *Config) *Config {
 
 // LoadProfile loads an existing profile
 func (c *Config) LoadProfile(name string) {
+	Debug("Trying to load profile: " + name)
 	conf := readConfig(c)
 	section, err := conf.GetSection(name)
 	if err != nil || section == nil {
@@ -268,6 +269,7 @@ func (c *Config) LoadProfile(name string) {
 	profile := new(ServerProfile)
 	conf.Section(name).MapTo(profile)
 	setActiveProfile(c, profile)
+	c.Core.ProfileName = name
 }
 
 // UpdateConfig updates and saves config