Skip to content

Commit e5189b5

Browse files
committed
Show the short hostname, not the FQDN in config_version
This is mainly a style and readability change. Prior to this, on masters whose hostname is actually their FQDN, the config_version script would show the entire FQDN. On nodes with really longs FQDN's, it was not very nice to look at. This takes the hostname of the master, splits it on dots (.) and takes the first segment. Now this: compile-master-02.int.lab.dmz.company-name.net-production-48fd18ab Is this: compile-master-02-production-48fd18ab
1 parent 09df4b4 commit e5189b5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

scripts/code_manager_config_version.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
environment = ARGV[1]
77

88
# Get the hostname of the Puppet master compiling the catalog.
9-
compiling_master = Socket.gethostname
9+
# Sometimes the hostname is the fqdn, so we'll take the first segment.
10+
compiling_master = Socket.gethostname.split('.').first
1011

1112
# Get the path to the Code Manager deployment info file.
1213
r10k_deploy_file_path = File.join(environmentpath, environment, '.r10k-deploy.json')

scripts/config_version.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
environment = ARGV[1]
1111

1212
# Get the hostname of the Puppet master compiling the catalog.
13-
compiling_master = Socket.gethostname
13+
# Sometimes the hostname is the fqdn, so we'll take the first segment.
14+
compiling_master = Socket.gethostname.split('.').first
1415

1516
# Get the path to the environment being compiled.
1617
repo = Rugged::Repository.discover(File.join(environmentpath, environment))

0 commit comments

Comments
 (0)