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

salt: 3006.5 (new cask) #162371

Merged
merged 1 commit into from
Dec 19, 2023
Merged

salt: 3006.5 (new cask) #162371

merged 1 commit into from
Dec 19, 2023

Conversation

cdalvaro
Copy link
Contributor

@cdalvaro cdalvaro commented Dec 12, 2023

Important: Do not tick a checkbox if you haven’t performed its action. Honesty is indispensable for a smooth review process.

After making any changes to a cask, existing or new, verify:

Additionally, if adding a new cask:

  • Named the cask according to the token reference.
  • Checked the cask was not already refused.
  • Checked the cask is submitted to the correct repo.
  • brew audit --cask --new salt worked successfully.
    • This check fails because there is a formula in the core repo called salt. Although that formula is deprecated and this cask is intended to replace it.
  • brew install --cask salt worked successfully.
  • brew uninstall --cask salt worked successfully.

@cdalvaro
Copy link
Contributor Author

cdalvaro commented Dec 12, 2023

This cask is a replacement for the deprecated and disabled salt formula. Maybe it's time to remove the salt formula from the core repository?

@cdalvaro
Copy link
Contributor Author

This cask is a replacement for the deprecated and disabled salt formula. Maybe it's time to remove the salt formula from the core repository?

I would like to know @SMillerDev's opinion about this.

@SMillerDev
Copy link
Member

Sounds fine to me, it's been deprecated and disabled for a while already.

Casks/s/salt.rb Outdated
Comment on lines 22 to 50
postflight do
random_str = (0...8).map { rand(65..90).chr }.join
%w[api master minion syndic].each do |daemon|
plist_file = "/Library/LaunchDaemons/com.saltstack.salt.#{daemon}.plist"
xml, = system_command! "plutil",
args: ["-convert", "xml1", "-o", "-", "--", plist_file],
sudo: true
xml = Plist.parse_xml(xml)

xml["EnvironmentVariables"] = {} unless xml.key?("EnvironmentVariables")
xml["EnvironmentVariables"]["HOMEBREW_PREFIX"] = HOMEBREW_PREFIX.to_s

path = xml["EnvironmentVariables"]["PATH"] || "/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
path = "#{HOMEBREW_PREFIX}/bin:#{path}" unless path.split(":").include?("#{HOMEBREW_PREFIX}/bin")
xml["EnvironmentVariables"]["PATH"] = path

new_plist_file = "/tmp/#{random_str}.#{File.basename(plist_file)}"
File.write(new_plist_file, xml.to_plist)
system_command! "plutil",
args: ["-lint", new_plist_file]

system_command! "mv",
args: [new_plist_file, plist_file],
sudo: true
system_command! "chown",
args: ["root:wheel", plist_file],
sudo: true
end
end
Copy link
Member

Choose a reason for hiding this comment

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

Can you provide some commentary on why this postflight block is necessary, and perhaps add a comment to code explaining it succinctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course!

The postflight is intended to add the HOMEBREW_PREFIX to the environment in order to make salt fully compatible with homebrew. Some modules require this environment variable to find not linked libraries. So, considering that this cask is being installed using homebrew, it is a valid assumption that we want that salt can find homebrew libraries.

This is an example of salt looking for HOMEBREW_PREFIX env variable. Also, in this PR, the use of this variable is added: saltstack/salt#64924

Apart of HOMEBREW_PREFIX, the PATH variable is also updated (only if needed) to include homebrew binaries.

I can add a comment to the postflight code explaining this if you think it would be useful!

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should use a post block to fix the deficiencies in salt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, as an alternative, could this be handled as an optional step, disabled by default?

Copy link
Member

Choose a reason for hiding this comment

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

No, it should be fixed upstream

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK... My last idea is to add some information in the caveats. So people can manually add these variables if needed. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe make an issue/PR upstream and link there with a caveat?

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'll try to improve this PR: saltstack/salt#64924

So, I think neither the modification of the plist files, nor the caveats documentation will be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

postflight removed

@bevanjkay bevanjkay changed the title salt: 3006.5 salt: 3006.5 (new cask) Dec 13, 2023
@cdalvaro cdalvaro force-pushed the salt-3006.5 branch 2 times, most recently from db71ecd to 9ee2b06 Compare December 14, 2023 16:57
Casks/s/salt.rb Outdated

Load services you need:

sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.api
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a .plist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Casks/s/salt.rb Outdated
Comment on lines 38 to 44
After installation, configure the Salt minion ID, and the Salt master location,
replacing the placeholder text with custom information:

sudo salt-config -i [MINION_ID] -m [SALT_MASTER_HOST]

See Configure the Salt master and minions for more configuration options:
https://docs.saltproject.io/salt/install-guide/en/latest/topics/configure-master-minion.html
Copy link
Member

Choose a reason for hiding this comment

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

Since this is not a homebrew specific instruction I don't think it should be a caveat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Casks/s/salt.rb Outdated
regex(/salt-(\d+(?:\.\d+)?(?:-\d+)?)-py3-#{arch}\.pkg/)
end

conflicts_with formula: "salt"
Copy link
Member

Choose a reason for hiding this comment

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

Now that salt has been removed from homebrew-core, this line needs to be removed here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Casks/s/salt.rb Outdated
Comment on lines 38 to 42
After installation, configure the Salt minion ID, and the Salt master location,
replacing the placeholder text with custom information:

sudo salt-config -i [MINION_ID] -m [SALT_MASTER_HOST]

Copy link
Member

Choose a reason for hiding this comment

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

Since this is not specific to the Homebrew install.

Suggested change
After installation, configure the Salt minion ID, and the Salt master location,
replacing the placeholder text with custom information:
sudo salt-config -i [MINION_ID] -m [SALT_MASTER_HOST]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Casks/s/salt.rb Outdated

sudo salt-config -i [MINION_ID] -m [SALT_MASTER_HOST]

Load services you need:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Load services you need:
Included services:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Casks/s/salt.rb Outdated

url "https://repo.saltproject.io/salt/py3/macos/minor/#{version}/salt-#{version}-py3-#{arch}.pkg"
name "Salt"
desc "World's fastest, most intelligent and scalable automation engine"
Copy link
Member

@bevanjkay bevanjkay Dec 18, 2023

Choose a reason for hiding this comment

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

Suggested change
desc "World's fastest, most intelligent and scalable automation engine"
desc "Automation and infrastructure management engine"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Casks/s/salt.rb Outdated
Comment on lines 30 to 32
zap trash: [
"/etc/salt",
]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
zap trash: [
"/etc/salt",
]
zap trash: "/etc/salt"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Casks/s/salt.rb Outdated

livecheck do
url "https://repo.saltproject.io/salt/py3/macos/latest"
regex(/salt-(\d+(?:\.\d+)?(?:-\d+)?)-py3-#{arch}\.pkg/)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
regex(/salt-(\d+(?:\.\d+)?(?:-\d+)?)-py3-#{arch}\.pkg/)
regex(/salt[._-]v?(\d+(?:\.\d+)+)-py3-#{arch}\.pkg/)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@bevanjkay bevanjkay added the ci-syntax-only Only run syntax checks on CI. Use only for bulk changes. label Dec 19, 2023
@bevanjkay
Copy link
Member

Thanks @cdalvaro

Using ci-syntax-only to skip the token conflict check.

@bevanjkay bevanjkay merged commit 89a7b34 into Homebrew:master Dec 19, 2023
8 of 10 checks passed
@cdalvaro cdalvaro deleted the salt-3006.5 branch December 19, 2023 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-syntax-only Only run syntax checks on CI. Use only for bulk changes. new cask
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants