Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust the cli directory structure.Fixed some bug. #168

Merged
merged 2 commits into from
Dec 11, 2017

Conversation

xxwjj
Copy link
Collaborator

@xxwjj xxwjj commented Dec 8, 2017

This pr fixed some bugs, and modfied the cli directory structure.

@coveralls
Copy link

coveralls commented Dec 8, 2017

Coverage Status

Coverage decreased (-0.1%) to 41.674% when pulling ea84820 on xxwjj:osdsctl_bugs into 33f4254 on opensds:development.

client/client.go Outdated
if c.Endpoint == "" {
c.Endpoint = os.Getenv("OPENSDS_ENDPOINT")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can't directly set the default endpoint like this, maybe it's a better idea to remind user to import OPENSDS_ENDPOINT first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the ENV to set the endpoint is ok, but one user want use the client must set the ENV first everytime, I think it`s not very friendly. And user usually use the client in the local host, I think is if one user does not specfied the OPENSDS_ENDPOINT , using the the localhost as its default value maybe better.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know what you said, what I mean is maybe a better way is to pull an error if user doesn't specify the ENV. One use case is that for a new user, if he doesn't specify the endpoint ENV, you solution will assign 127.0.0.1:50040 to the variable, but if something goes wrong, user would be confused about the reported error since he didn't notice that he needs to configure the endpoint.
What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can print in log file to notice user, or get the endpoint infoamtion from config file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about storing the default endpoint of both config and client in a unified file, and the client will be set to 127.0.0.1:50040 default?

@@ -24,12 +24,19 @@ import (
"log"
"os"

"github.com/opensds/opensds/pkg/cli"
"github.com/opensds/opensds/osdsctl"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't get it what's the difference between these two package path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI will invoke the CLIENT packages, but the directory hierarchy of CLIENT packges is higher than the CLI`s. And this makes a little confusing for developers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, in this way, I suggest you could have a look at etcd and see what we can learn from it.

@@ -177,3 +178,14 @@ func MergeStringMaps(maps ...map[string]string) map[string]string {
}
return out
}

func PathExists(path string) (bool, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add unit test of this function? And one thing need to mention is that I guess you didn't run go fmt ..., please have a check at it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I got it.

@coveralls
Copy link

coveralls commented Dec 11, 2017

Coverage Status

Coverage increased (+0.09%) to 42.736% when pulling 218277b on xxwjj:osdsctl_bugs into 762c72a on opensds:development.

@leonwanghui
Copy link
Collaborator

good!

@leonwanghui leonwanghui merged commit 337376b into sodafoundation:development Dec 11, 2017
@xxwjj xxwjj deleted the osdsctl_bugs branch February 28, 2018 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants