Alexandros Kosiaris has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/356032 )

Change subject: Remove to_i/Integer from now unstringified facts
......................................................................


Remove to_i/Integer from now unstringified facts

Now that we have non-stringified facts, processorcount/physicalcorecount
etc. are now guaranteed to be integers and don't need to be wrapped with
Integer() or converted with to_i.

Bug: T166372
Change-Id: I93b536a23edfbc12a13bf81c285be088fef8ae56
---
M modules/backup/templates/mysql-predump.erb
M modules/bacula/templates/bpipe-mysql-db.erb
M modules/ganglia/templates/gmetad.conf.erb
M modules/ifttt/manifests/web.pp
M modules/puppetmaster/templates/passenger.conf.erb
M modules/recommendation_api/manifests/init.pp
M modules/role/templates/mariadb/mysqld_config/production.my.cnf.erb
M modules/tlsproxy/templates/nginx.conf.erb
M modules/toollabs/manifests/node/all.pp
M modules/toollabs/templates/gridengine/host-unrestricted.erb
M modules/toollabs/templates/gridengine/host-vmem.erb
M modules/toollabs/templates/gridengine/host-web.erb
M modules/varnish/templates/initscripts/varnish.systemd.erb
M modules/wikilabels/manifests/web.pp
14 files changed, 18 insertions(+), 18 deletions(-)

Approvals:
  Alexandros Kosiaris: Verified; Looks good to me, approved



diff --git a/modules/backup/templates/mysql-predump.erb 
b/modules/backup/templates/mysql-predump.erb
index a4b789a..121470c 100644
--- a/modules/backup/templates/mysql-predump.erb
+++ b/modules/backup/templates/mysql-predump.erb
@@ -17,7 +17,7 @@
 DATE=$(date "+%Y%m%d%H%M")
 
 # Let's be polite and not use all available processors
-PIGZ="/usr/bin/pigz -p <%= Integer(@processorcount)/8 > 1 ? 
Integer(@processorcount)/8 : 1 %> "
+PIGZ="/usr/bin/pigz -p <%= @processorcount/8 > 1 ? @processorcount/8 : 1 %> "
 PIGZD="/usr/bin/pigz -d"
 <% if @pigz_level -%>
 PIGZ="$PIGZ --<%= @pigz_level -%>"
diff --git a/modules/bacula/templates/bpipe-mysql-db.erb 
b/modules/bacula/templates/bpipe-mysql-db.erb
index 667ec4c..0326142 100644
--- a/modules/bacula/templates/bpipe-mysql-db.erb
+++ b/modules/bacula/templates/bpipe-mysql-db.erb
@@ -16,7 +16,7 @@
 <% end -%>
 
 # Let's be polite and not use all available processors
-PIGZ="/usr/bin/pigz -p <%= Integer(@processorcount)/2 > 1 ? 
Integer(@processorcount/2) : 1 %> "
+PIGZ="/usr/bin/pigz -p <%= @processorcount/2 > 1 ? @processorcount/2 : 1 %> "
 PIGZD="/usr/bin/pigz -d"
 <% if @pigz_level -%>
 PIGZ="$PIGZ --<%= @pigz_level -%>"
@@ -46,7 +46,7 @@
 for database in `$MYSQL -B -N -e "show databases"`
 do
 <% if @xtrabackup -%>
-echo "bpipe:/XTRABACKUP/$database:$INNOBACKUPEX --stream=xbstream 
--parallel=<%= Integer(@processorcount)/2 > 1 ? Integer(@processorcount/2) : 1 
%> --databases=$database /dev/null | $PIGZ:$PIGZD | $XBSTREAM ; $INNOBACKUPEX 
--apply-log @xbstream_dir"
+echo "bpipe:/XTRABACKUP/$database:$INNOBACKUPEX --stream=xbstream 
--parallel=<%= @processorcount/2 > 1 ? @processorcount/2 : 1 %> 
--databases=$database /dev/null | $PIGZ:$PIGZD | $XBSTREAM ; $INNOBACKUPEX 
--apply-log @xbstream_dir"
 <% else -%>
 <% if @local_dump_dir -%>
 # note the ':' sign separating the export ($MYSQLDUMP) and the import ($MYSQL) 
actions- it is easy to miss
@@ -58,7 +58,7 @@
 done
 <% else -%>
 <% if @xtrabackup -%>
-echo "bpipe:/XTRABACKUP/all:$INNOBACKUPEX --stream=xbstream --parallel=<%= 
Integer(@processorcount)/2 > 1 ? Integer(@processorcount/2) : 1 %> /dev/null | 
$PIGZ:$PIGZD | $XBSTREAM ; $INNOBACKUPEX --apply-log <%= @xbstream_dir -%>"
+echo "bpipe:/XTRABACKUP/all:$INNOBACKUPEX --stream=xbstream --parallel=<%= 
@processorcount/2 > 1 ? @processorcount/2 : 1 %> /dev/null | $PIGZ:$PIGZD | 
$XBSTREAM ; $INNOBACKUPEX --apply-log <%= @xbstream_dir -%>"
 <% else -%>
 <% if @local_dump_dir -%>
 echo "bpipe:/MYSQLDUMP/all:$MYSQLDUMP --all-databases --create-options -c | 
$TEE $LOCALDUMPDIR/all-$DATE.dump | $PIGZ:$PIGZD | $MYSQL"
diff --git a/modules/ganglia/templates/gmetad.conf.erb 
b/modules/ganglia/templates/gmetad.conf.erb
index 9adbf9d..0b215cc 100644
--- a/modules/ganglia/templates/gmetad.conf.erb
+++ b/modules/ganglia/templates/gmetad.conf.erb
@@ -41,7 +41,7 @@
 xml_port 8653
 interactive_port 8654
 #The number of simultaneous connections allowed to connect to the listen ports.
-server_threads <%= @processorcount.to_i/2 %>
+server_threads <%= @processorcount/2 %>
 # Where gmetad stores its round-robin databases
 # default: "/var/lib/ganglia/rrds"
 # rrd_rootdir "/some/other/place"
diff --git a/modules/ifttt/manifests/web.pp b/modules/ifttt/manifests/web.pp
index f18a246..7dc8b27 100644
--- a/modules/ifttt/manifests/web.pp
+++ b/modules/ifttt/manifests/web.pp
@@ -15,7 +15,7 @@
                 chdir       => $ifttt::base::source_path,
                 http-socket => '0.0.0.0:8080',
                 venv        => $ifttt::base::venv_path,
-                processes   => inline_template("<%= @processorcount.to_i * 
${workers_per_core} %>"),
+                processes   => $facts['processorcount'] * $workers_per_core,
             }
         }
     }
diff --git a/modules/puppetmaster/templates/passenger.conf.erb 
b/modules/puppetmaster/templates/passenger.conf.erb
index 5cd48b3..808d0c8 100644
--- a/modules/puppetmaster/templates/passenger.conf.erb
+++ b/modules/puppetmaster/templates/passenger.conf.erb
@@ -2,7 +2,7 @@
 
 # Passenger configuration
 PassengerHighPerformance on
-PassengerMaxPoolSize <%= scope.lookupvar('::processorcount').to_i * 4 %>
+PassengerMaxPoolSize <%= @processorcount * 4 %>
 PassengerPoolIdleTime 1500
 PassengerMaxRequests 2000
 PassengerStatThrottleRate 120
diff --git a/modules/recommendation_api/manifests/init.pp 
b/modules/recommendation_api/manifests/init.pp
index 05edd4b..1ae872f 100644
--- a/modules/recommendation_api/manifests/init.pp
+++ b/modules/recommendation_api/manifests/init.pp
@@ -64,7 +64,7 @@
                 'http-socket' => '0.0.0.0:8080',
                 'socket'      => '/run/uwsgi/recommendation_api.sock',
                 'pythonpath'  => $lib_dir,
-                'processes'   => inline_template('<%= @processorcount.to_i 
%>'),
+                'processes'   => $facts['processorcount'],
             },
         },
         require  => [
diff --git a/modules/role/templates/mariadb/mysqld_config/production.my.cnf.erb 
b/modules/role/templates/mariadb/mysqld_config/production.my.cnf.erb
index 38de452..9d1e44e 100644
--- a/modules/role/templates/mariadb/mysqld_config/production.my.cnf.erb
+++ b/modules/role/templates/mariadb/mysqld_config/production.my.cnf.erb
@@ -56,7 +56,7 @@
 <% end -%>
 <% if Float(@memorysize.split[0]) > 200.0 -%>
 thread_pool_size               = 64
-<% elsif Integer(@processorcount) <= 32 -%>
+<% elsif @processorcount <= 32 -%>
 thread_pool_size               = 32
 <% else -%>
 thread_pool_size               = <%= @processorcount %>
diff --git a/modules/tlsproxy/templates/nginx.conf.erb 
b/modules/tlsproxy/templates/nginx.conf.erb
index 5254359..1eef9b0 100644
--- a/modules/tlsproxy/templates/nginx.conf.erb
+++ b/modules/tlsproxy/templates/nginx.conf.erb
@@ -11,12 +11,12 @@
 worker_processes  <%= @processorcount %>;
 <%
     ht_mode = false
-    if @processorcount.to_i == (2 * @physicalcorecount.to_i)
+    if @processorcount == (2 * @physicalcorecount)
         ht_mode = true
     end
     affinity_mask = Array.new
     cpupos = 0
-    ncpus = @physicalcorecount.to_i
+    ncpus = @physicalcorecount
     (0...ncpus).each do |worker|
         bitmask = (1 << cpupos).to_s(2)
         bitstring = '0' * (ncpus - bitmask.size) + bitmask.to_s
diff --git a/modules/toollabs/manifests/node/all.pp 
b/modules/toollabs/manifests/node/all.pp
index 722892b..df4a43c 100644
--- a/modules/toollabs/manifests/node/all.pp
+++ b/modules/toollabs/manifests/node/all.pp
@@ -18,7 +18,7 @@
 
     if $swap_partition {
         labs_lvm::swap { 'big':
-            size => inline_template('<%= @memorysize_mb.to_i * 3 %>MB'),
+            size => inline_template('<%= @memorysize_mb * 3 %>MB'),
         }
     }
 }
diff --git a/modules/toollabs/templates/gridengine/host-unrestricted.erb 
b/modules/toollabs/templates/gridengine/host-unrestricted.erb
index a7ed4d0..e51f5f9 100644
--- a/modules/toollabs/templates/gridengine/host-unrestricted.erb
+++ b/modules/toollabs/templates/gridengine/host-unrestricted.erb
@@ -1,5 +1,5 @@
 hostname              <%= @fqdn %>
-complex_values        slots=<%= 100*(@processorcount.to_i) %>,release=<%= 
@lsbdistcodename %>
+complex_values        slots=<%= 100 * @processorcount %>,release=<%= 
@lsbdistcodename %>
 load_scaling          NONE
 user_lists            NONE
 xuser_lists           NONE
diff --git a/modules/toollabs/templates/gridengine/host-vmem.erb 
b/modules/toollabs/templates/gridengine/host-vmem.erb
index 2dd4c79..a39d8ca 100644
--- a/modules/toollabs/templates/gridengine/host-vmem.erb
+++ b/modules/toollabs/templates/gridengine/host-vmem.erb
@@ -1,6 +1,6 @@
 hostname              <%= @fqdn %>
-complex_values        h_vmem=<%= ((@swapsize_mb.to_i)>>10) + 
((@memorysize_mb.to_i)>>10)
-                      %>G,slots=<%= 16*(@processorcount.to_i) %>,release=<%= 
@lsbdistcodename %>
+complex_values        h_vmem=<%= (@swapsize_mb >> 10) + (@memorysize_mb >> 10)
+                      %>G,slots=<%= 16 * @processorcount %>,release=<%= 
@lsbdistcodename %>
 load_scaling          NONE
 user_lists            NONE
 xuser_lists           NONE
diff --git a/modules/toollabs/templates/gridengine/host-web.erb 
b/modules/toollabs/templates/gridengine/host-web.erb
index f7623c7..d0e2a2f 100644
--- a/modules/toollabs/templates/gridengine/host-web.erb
+++ b/modules/toollabs/templates/gridengine/host-web.erb
@@ -1,5 +1,5 @@
 hostname              <%= @fqdn %>
-complex_values        slots=<%= 32*(@processorcount.to_i) %>,release=<%= 
@lsbdistcodename %>
+complex_values        slots=<%= 32 * @processorcount %>,release=<%= 
@lsbdistcodename %>
 load_scaling          NONE
 user_lists            NONE
 xuser_lists           NONE
diff --git a/modules/varnish/templates/initscripts/varnish.systemd.erb 
b/modules/varnish/templates/initscripts/varnish.systemd.erb
index fda8d40..5b3d4c3 100644
--- a/modules/varnish/templates/initscripts/varnish.systemd.erb
+++ b/modules/varnish/templates/initscripts/varnish.systemd.erb
@@ -21,7 +21,7 @@
 <%= @ports.map { |p| "-a :"+p }.join(" ") -%> \
 -T 127.0.0.1:<%= @admin_port -%> \
 -f /etc/varnish/wikimedia_<%= @vcl -%>.vcl \
--p thread_pool_min=250 -p thread_pool_max=<%= @processorcount.to_i * 250 -%> 
-p thread_pool_timeout=120 \
+-p thread_pool_min=250 -p thread_pool_max=<%= @processorcount * 250 -%> -p 
thread_pool_timeout=120 \
 -p vsl_reclen=2048 \
 -p workspace_backend=128k \
 -p vcc_allow_inline_c=true \
diff --git a/modules/wikilabels/manifests/web.pp 
b/modules/wikilabels/manifests/web.pp
index 6abc4f7..69d05e4 100644
--- a/modules/wikilabels/manifests/web.pp
+++ b/modules/wikilabels/manifests/web.pp
@@ -49,7 +49,7 @@
                 chdir       => $config_path,
                 http-socket => '0.0.0.0:8080',
                 venv        => $venv_path,
-                processes   => inline_template('<%= @processorcount.to_i * 4 
%>'),
+                processes   => $facts['processorcount'] * 4,
                 die-on-term => true,
                 harakiri    => 30,
             }

-- 
To view, visit https://gerrit.wikimedia.org/r/356032
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I93b536a23edfbc12a13bf81c285be088fef8ae56
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: Coren <[email protected]>
Gerrit-Reviewer: Ema <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to