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

Switched home fetch to local function with windows compatability #568

Merged
merged 6 commits into from
Feb 15, 2019

Conversation

yaoharry
Copy link
Member

@yaoharry yaoharry commented Feb 15, 2019

🎟️ Ticket(s): Closes #400 , closes #519 , follow-up to #552


👷 Changes

Updated home path checking with local function with windows compatibility check

🔦 Testing Instructions

  • Ensure $HOME environment variable is the same as returned value from local.GetHomePath()
  • Run main unit tests

Copy link
Member

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

awesome work, looks great! 😁 a few minor nitpicks if you want to fix them!

cmd/inpututil/input.go Outdated Show resolved Hide resolved
sshDir := filepath.Join(homeEnvVar, ".ssh")
defaultSSHLoc := filepath.Join(sshDir, "id_rsa")

var response string
fmt.Println("Enter location of PEM file (leave blank to use '" + defaultSSHLoc + "'):")
_, err := fmt.Fscanln(in, &response)
_, err = fmt.Fscanln(in, &response)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

while you're at it, could make this a one-liner? 😋

if _, err = fmt.Fscanln(in, &response); err != nil {
  ...
} 

@bobheadxi bobheadxi added the pr: finalized needs review and final approval label Feb 15, 2019
@codecov
Copy link

codecov bot commented Feb 15, 2019

Codecov Report

Merging #568 into master will decrease coverage by 0.11%.
The diff coverage is 12.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #568     +/-   ##
=========================================
- Coverage   56.19%   56.08%   -0.1%     
=========================================
  Files          62       62             
  Lines        3015     3019      +4     
=========================================
- Hits         1694     1693      -1     
- Misses       1115     1119      +4     
- Partials      206      207      +1
Impacted Files Coverage Δ
provision/ec2.go 8.13% <0%> (-0.12%) ⬇️
cmd/inpututil/input.go 87.88% <25%> (-1.91%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e30e67...051a548. Read the comment docs.

)

// getTrueDirectory converts given filepath to host-based filepath if applicable
// - Docker commands are sent to the mounted Docker socket and hence are
// executed on the host, using the host's filepaths, which means Docker client
// commands must use this function when dealing with paths
func getTrueDirectory(path string) string {
return strings.Replace(path, "/app/host", os.Getenv("HOME"), 1)
homeDir, _ := local.GetHomePath()
return strings.Replace(path, "/app/host", homeDir, 1)
Copy link
Member

Choose a reason for hiding this comment

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

we should remove this for now - daemonside windows compatibility is a much harder and nuanced issue, and a separate ticket is open for that (#407). Also trying to avoid introducing dependencies on inertia/local from the daemon for now, to avoid dependency creep 👌

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for letting me know. I reverted the changes for util.go.

@bobheadxi bobheadxi merged commit 92c0ef4 into master Feb 15, 2019
@bobheadxi bobheadxi deleted the provision/#400-ec2-windows branch February 15, 2019 20:31
@bobheadxi
Copy link
Member

great work @yaoharry !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: finalized needs review and final approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI Windows compatibility provision/ec2: windows compatibility
2 participants