Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Copy from "new" location of .erlang.cookie file #82

Merged
merged 2 commits into from
Jul 3, 2018

Conversation

lukebakken
Copy link
Contributor

@lukebakken lukebakken requested a review from dumbbell June 27, 2018 22:06
@@ -132,6 +132,7 @@ Section "RabbitMQ Service" RabbitService
ReadEnvStr $1 "HOMEDRIVE"
ReadEnvStr $2 "HOMEPATH"
CopyFiles "$WINDIR\.erlang.cookie" "$1$2\.erlang.cookie"
CopyFiles "$SystemRoot\System32\config\systemprofile\.erlang.cookie" "$1$2\.erlang.cookie"
Copy link
Member

Choose a reason for hiding this comment

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

When the source file is missing, CopyFiles logs an error. That's how I found this issue.

Should we use IfFileExists before calling CopyFiles to avoid this error message?

Copy link
Member

Choose a reason for hiding this comment

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

That would make sense to me.

@lukebakken
Copy link
Contributor Author

Thanks @dumbbell I looked in the docs for something like that but couldn't find it.

@lukebakken
Copy link
Contributor Author

👍 let's get this merged and tested :-)

@@ -131,7 +131,12 @@ Section "RabbitMQ Service" RabbitService
ExecDos::exec /DETAILED '"$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" start' ""
ReadEnvStr $1 "HOMEDRIVE"
ReadEnvStr $2 "HOMEPATH"
CopyFiles "$WINDIR\.erlang.cookie" "$1$2\.erlang.cookie"
IfFileExists "$SystemRoot\System32\config\systemprofile\.erlang.cookie" 0 +5
CopyFiles "$SystemRoot\System32\config\systemprofile\.erlang.cookie" "$1$2\.erlang.cookie"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder, if .erlang.cookie already exists from a previous installation, will we get an access error due to permissions? The installer should be running with an admin account but it would be worth testing. I have seen strange "access denied" errors when copying cookies that have required deleting the previous one before copying the new one 🤷‍♂️

https://www.rabbitmq.com/install-windows-manual.html#erlang-cookie

Fixes #81

packaging/windows: Look at Erlang 20.2+ cookie's location as well

While here, check if the cookie exists before copying it. This fixes an
uninformative error message in the installer output.

Use NSIS variable $SYSDIR
@lukebakken
Copy link
Contributor Author

@michaelklishin @dumbbell this isn't working right and I'm investigating.

@lukebakken
Copy link
Contributor Author

OK, finally figured it out. Issue copying file was due to X64 redirection.

QA steps on my Win 8.1 VM:

  • Install Erlang 20.3 and RMQ 3.7.6
  • Run RabbitMQ sbin prompt from start menu
  • Run rabbitmqctl.bat status, note that you get an error due to cookie mis-match.
  • Note that C:\Users\me\.erlang.cookie is not the same as C:\Windows\system32\config\systemprofile\.erlang.cookie
  • Uninstall RabbitMQ
  • Delete all cookies
  • Install RMQ with an .exe containing this branch (or binary artifact after merge)
  • Run RabbitMQ sbin prompt from start menu
  • Run rabbitmqctl.bat status which will succeed.
  • Check that cookies match

@michaelklishin
Copy link
Member

Let's get this through the pipeline and test the final artifact.

@michaelklishin michaelklishin merged commit b902000 into master Jul 3, 2018
@michaelklishin michaelklishin deleted the rabbitmq-server-release-81 branch July 3, 2018 22:11
@dumbbell
Copy link
Member

dumbbell commented Jul 4, 2018

I confirm it works for me too! Thank you @lukebakken! I was experimenting on my side yesterday as well, but couldn't figure out what was wrong with IfFileExists.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants