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

Default to localhost in srv files mgr. #2344

Merged
merged 7 commits into from
Jul 26, 2017

Conversation

hjoliver
Copy link
Member

@hjoliver hjoliver commented Jul 5, 2017

Close #2340
Close #526

  • default to localhost in service files manager (currently just falls over if --user specified but not --host)
  • if localhost, attempt to read remote (i.e. other user) suite contact file via the local filesystem first, so that non-interactive ssh is not needed to the suite account.

@hjoliver hjoliver added bug Something is wrong :( small labels Jul 5, 2017
@hjoliver hjoliver added this to the next release milestone Jul 5, 2017
@hjoliver hjoliver self-assigned this Jul 5, 2017
@matthewrmshin
Copy link
Contributor

(The change looks good enough, but I'll need to test it to see if it really works.)

@hjoliver
Copy link
Member Author

hjoliver commented Jul 6, 2017

Adding proper tests seems difficult in this case...

@matthewrmshin
Copy link
Contributor

Agreed.

value = value.replace(os.environ['HOME'], '$HOME')
elif owner != USER:
# replace USER with owner for direct access via local filesys
value = value.replace('/%s/' % USER, '/%s/' % owner)
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only work if we have /home/hilary/, /home/matt, etc. It will not work if we have something like /home/disk1/hilary/, /home/disk2/matt/, etc.

os.path.expanduser will work with strings with ~ or ~user prefixes, but we'll still have issues if the value is not under HOME.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point (you mean if different users have different home locations, right?).

Copy link
Member Author

Choose a reason for hiding this comment

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

we'll still have issues if the value is not under HOME

I presume os.path.expanduser("~user") works regardless, but do you mean if the user has configured a non-standard run directory location? (I wonder if we're assuming the standard location anywhere else at this point...)

Copy link
Contributor

Choose a reason for hiding this comment

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

That as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

(Just to clarify.) While ~matt/ is normally /home/matt/, it can be anything as well, e.g. /net/home/disk2/matt/ or worse.

Copy link
Member Author

Choose a reason for hiding this comment

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

(yes, but os.path.expanduser(~user) should return /net/home/disk2/matt in that case, no?)

Copy link
Member Author

Choose a reason for hiding this comment

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

(in which case we could assume ~user/cylc-run/ rather than replacing /me/ with /you/ in the path - that would work so long as ~you has not configured a non-standard cylc-run location.)

Copy link
Contributor

Choose a reason for hiding this comment

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

os.path.expanduser(~user) should work for all instances of ~user/cylc-run/, but will not work for non-standard locations, which is probably good enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, that's the best we can do without attempt to parse other users global config files. I'll implement os.path.expanduser() to finish off this PR...

@dvalters
Copy link
Contributor

Code looks ok so far, I am just wondering how to test it in my environment (don't think I can create extra users on here...)

@hjoliver
Copy link
Member Author

hjoliver commented Jul 25, 2017

Rebased, and now uses os.path.expanduser(). I'll just document use of the local filesystem to read the contact file... [punted to #2343]

@hjoliver
Copy link
Member Author

3rd-to-last commit restores command transcripts to the user guide (lost in the recent bin/cylc refactor).

Should be good to go now if tests pass...

@dvalters dvalters merged commit 21887e0 into cylc:master Jul 26, 2017
@hjoliver hjoliver deleted the 2340.default-to-localhost branch July 26, 2017 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :( small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants