tweek 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +71 -34
  3. data/bin/tweek +4 -7
  4. data/lib/tweek/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1e291275563c2896f9c59ee25c11486e0a891f7
4
- data.tar.gz: e97cac8c95c5beda3dc9ec48a3c4ea418c5d6bbc
3
+ metadata.gz: 597134731238b0b8b85cff135316ba1583820159
4
+ data.tar.gz: 5f6817a52a96db1a1cf6fef2ba90657699c637ac
5
5
  SHA512:
6
- metadata.gz: 49c42da3fcfa156d2f12cd6fdf561fb2a010982f7e272ec45ec00d49f7f829021606cd8f26bd78679791ad8c58125ff360118ce2a9a5a69890b7c9432ea6e59e
7
- data.tar.gz: b2c84d89a856596c074c941e757d047b902877a4a4ad513ca0b22e42bc88fb4f196b0140e9fd0cb4aececd9200f3a746648899520c3fa8c345a36b5080f1fc8e
6
+ metadata.gz: 8c2a6e275f98ec45e9faa64317e75894d41100ccfd6ad746d94eedcf1d81e5123201988182d5f52ee124dd6b9760cec092844286b12b9e43f3fd74d4447e155a
7
+ data.tar.gz: b074907fdea87694c3f2fd0106f6a3d1ac5aac430c984ae9752a4309c222784cc39d9bdd2f0e70b00b70ef3a4659fe2797800a1a88be070d424d4f643ce1a0bc
data/README.md CHANGED
@@ -19,12 +19,16 @@ user to check obscure settings without actually knowing the commands needed.
19
19
  One of the objectives of the Tweek GitHub repository is to serve as a repository for sets
20
20
  of configuration parameters that have been found by the community to be useful in
21
21
  maximizing performance for certain machines and workloads. It is hoped people will submit
22
- pull requests to add settings files to the `settings` subdirectory of this project.
22
+ pull requests to add settings files to the `settings` subdirectory of this project. These
23
+ can then be referenced directly using URLs, or downloaded locally then edited to suit
24
+ prior to running.
23
25
 
24
26
  ## Installation
25
27
 
26
- Tweek has been written to use Ruby 1.8.7 or above which is available on all Linux systems
27
- within the last five years or so. It also requires `rubygems`.
28
+ Tweek requires use Ruby 1.8.7 or above and so can be used on all Linux systems
29
+ within the last five years or so.
30
+
31
+ When using Ruby 1.8.7 note that using settings file via `https` URLs can be problematic.
28
32
 
29
33
  ### Do I need to be the 'root' user?
30
34
 
@@ -49,43 +53,34 @@ successful. You should now be able to type `tweek -?` to see the available optio
49
53
 
50
54
  ## Usage
51
55
 
52
- Tweek can be used in the following modes:
53
-
54
- * To check the current system against a default configuration
55
- * To create a sample settings file that you can edit manually
56
- * To generate a settings file based on the current system configuration
57
- * To check the current system configuration against a file of settings.
58
- * To set the current system configuration to a file of settings.<br>
59
- __NOTE__ this is currently restricted to `sysctl` parameters only. TBD.
60
-
61
- In the first case Tweek uses a built-in set of defaults. To check using these simply run:
62
-
63
- ```
64
- tweek
65
- ```
56
+ Tweek can be used in several ways:
66
57
 
67
- Tweek will read the sample settings from the default file `settings/sample.set` (which is
68
- installed as part of the Gem) and check them. The output is self-explanatory.
58
+ * To create a sample settings file that you can edit manually,
59
+ * To check the current system against a desired configuration embodied in a file of settings,
60
+ * To set or reset the current system configuration to a file of settings.<br>
61
+ __NOTE__ set/reset is currently restricted to `sysctl` parameters only. TBD.
69
62
 
70
- All the other uses involve the settings file. Documentation is contained within the
71
- sample settings and you should read them for a full understanding of what is possible.
72
- Use `tweek -s` to show them.
63
+ The settings file can be local or remote (using a variety of URL formats). It has a simple text format
64
+ which is fully documented in a sample file that can be generated using `tweek -s`.
73
65
 
74
66
  ### Output
75
67
 
76
68
  The output of Tweek is controlled by the `output` option, which takes the following
77
69
  values (default `1`):
78
70
 
79
- 0. No output, just a return code.
71
+ 0. No output, just a return code.<br>
72
+ Useful when using `pssh` or `mush` to execute on multiple machines.
80
73
 
81
- 1. Summary output only is written to STDERR. It consists of a string of dots (when a
82
- parameter is OK) or the letter 'F' (when a parameter doesn't match) followed by a
83
- summary line.
74
+ 1. Summary output only is written to STDERR.<br>
75
+ It consists of a string of dots (when a parameter is OK) or the letter 'F'
76
+ (when a parameter doesn't match) or the letter 's'
77
+ (when a parameter is skipped due to failing a condition check), followed by a summary line.
84
78
 
85
- 2. Only the settings that didn't match are written to STDOUT in a form that can be reused
86
- as input. The summary is written to STDERR
79
+ 2. The summary is written to STDERR.<br>
80
+ Only the settings that **didn't** match are written to STDOUT in a form that can be reused as input.
87
81
 
88
- 3. All the settings are written to STDOUT in a form that can be reused as input.
82
+ 3. The summary is written to STDERR.<br>
83
+ **All** the settings are written to STDOUT in a form that can be reused as input.
89
84
 
90
85
  The latter formats differ slightly depending on whether the utility is operating in query
91
86
  mode, set mode or reset mode. See below.
@@ -93,7 +88,7 @@ mode, set mode or reset mode. See below.
93
88
  Note that the output is colorized by default. Disable this with `--no-color`.
94
89
 
95
90
  * red: a value that doesn't match or conditions that are not met
96
- * yellow: expected values
91
+ * yellow: expected or previous values
97
92
  * green: conditions that are met
98
93
  * bold: emphasis
99
94
 
@@ -107,16 +102,16 @@ The actions of Tweek are controlled by the `mode` option, which takes the follow
107
102
  <dt>query</dt>
108
103
 
109
104
  <dd>the settings are checked against the actual values and mismatches are highlighted and
110
- noted in a comment with the syntax '[expected xxx]'</dd>
105
+ noted in a comment with the syntax <tt>[expected xxx]</tt></dd>
111
106
 
112
107
  <dt>set</dt>
113
108
 
114
109
  <dd>the settings are set to the given value, mismatches are highlighted and noted in a
115
- trailing comment with the syntax '[was xxx]'</dd>
110
+ trailing comment with the syntax <tt>[was xxx]</tt></dd>
116
111
 
117
112
  <dt>reset</dt>
118
113
 
119
- <dd>action as above but the settings are taken from the '[was xxx]' comments</dd>
114
+ <dd>action as above but the settings are taken from the <tt>[was xxx]</tt> comments</dd>
120
115
 
121
116
  </dl>
122
117
 
@@ -132,7 +127,7 @@ highlighting (using Ruby as the language) makes it very readable.
132
127
  ### Comments
133
128
 
134
129
  Comments are of two sorts:
135
- * Inline: after the first # on any line
130
+ * Inline: after the first `#` on any line
136
131
  * Block: Following the Ruby convention these begin with `=begin` and end with `=end`
137
132
 
138
133
  ### Sections
@@ -192,6 +187,48 @@ An example for Redhat 7 is:
192
187
  tweek --distro=RedHatEnterpriseServer --distro-ver=7.4 --kernel-ver=3.10.0
193
188
  ```
194
189
 
190
+ ## Example
191
+
192
+ Given the following input file `sysctl.twk`:
193
+
194
+ ```text
195
+ # Sample test file
196
+
197
+ SYSCTL
198
+
199
+ kernel.msgmax = 65536 if k ~> 3.1
200
+ kernel.shmmax = 4000000000 if k>2.5 # Crazy high!
201
+ kernel.shmall = 4294967296
202
+ ```
203
+
204
+ ### Querying Current Values
205
+
206
+ Running the command `tweek -o 3 sysctl.twk` produces the following output:
207
+
208
+ <a><img src="./query.svg"/></a>
209
+
210
+ Note that red denotes conditions that weren't met, or values that differed from the
211
+ expected ones. Green denotes conditions that were met, and yellow is used to highlight
212
+ expected values, that are called out in the comments.
213
+
214
+ ### Setting New Values
215
+
216
+ Running the command `tweek -m s -o 3 sysctl.twk` produces the following output:
217
+
218
+ <a><img src="./set.svg"/></a>
219
+
220
+ Note that colors have the same meaning, but now the previous values (if different) are
221
+ recorded in yellow. You can save this format for use in `reset` mode, if using
222
+ redirection the `--no-color` option removes the ANSI escape sequences.
223
+
224
+ ### Resetting Values
225
+
226
+ Running the command `tweek -m r -o 3 <above output>` produces the following output:
227
+
228
+ <a><img src="./reset.svg"/></a>
229
+
230
+ Note that a value will only be reset if it matches!
231
+
195
232
  ## Development
196
233
 
197
234
  Tweek was developed using the gem `bundler`. Ensure you have both this and `rake` installed using:
data/bin/tweek CHANGED
@@ -26,8 +26,8 @@ cflag = true
26
26
  distro = nil
27
27
  distro_ver = nil
28
28
  kernel_ver = nil
29
- OptionParser.new do |o|
30
- o.banner = "Usage: #{$0} [options] [settings_file...]"
29
+ optparse = OptionParser.new do |o|
30
+ o.banner = "Usage: #{$0} [options] settings_files..."
31
31
  o.separator ""
32
32
  o.separator "Check and/or update the system parameters specified in the settings files"
33
33
  o.separator "(If not supplied then built-in samples are used)"
@@ -107,11 +107,8 @@ if kernel_ver.nil?
107
107
  end
108
108
  cs = Tweek::File.new(distro, distro_ver, kernel_ver, mflag, oflag)
109
109
  if ARGV.empty?
110
- if mflag != :query
111
- STDERR.puts "You can't update the system with the sample settings, specify one or more Tweek files!"
112
- exit 2
113
- end
114
- fh = File.open(File.expand_path('../../settings/sample.twk',__FILE__))
110
+ STDERR.puts optparse
111
+ exit 2
115
112
  else
116
113
  dir = FileUtils.pwd
117
114
  ARGV.each do |file|
@@ -1,3 +1,3 @@
1
1
  module Tweek
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweek
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Townsend
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-14 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize