forked from aws/opsworks-cookbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show correct Operating System for Red Hat Enterprise Linux 7 in motd.
The file /etc/issue looks on Red Hat Enterprise Linux 7 like this: ~~~ \S Kernel \r on an \m ~~~ The \S gets expanded to the current release. For this reason the existing functionality doesn't work as expected. The File /etc/redhat-release contains the correct version string: Red Hat Enterprise Linux Server release 7.1 (Maipo)
- Loading branch information
Showing
2 changed files
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
os_release = | ||
if node[:platform] == "redhat" && Chef::VersionConstraint.new("~> 7.0").include?(node["platform_version"]) | ||
os_release = File.read("/etc/redhat-release").chomp | ||
else | ||
`head -1 /etc/issue | sed -e 's/ \\\\.*//'`.chomp | ||
end | ||
|
||
template "/etc/motd.opsworks-static" do | ||
source "motd.erb" | ||
mode "0644" | ||
variables({ | ||
:stack => node[:opsworks][:stack], | ||
:layers => node[:opsworks][:layers], | ||
:instance => node[:opsworks][:instance], | ||
:os_release => os_release | ||
}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters