summaryrefslogtreecommitdiff
path: root/lib/ohai/plugins
Commit message (Collapse)AuthorAgeFilesLines
* Fix XLC compiler detection to support 3 part version numbersxlcTim Smith2020-11-231-3/+3
| | | | | | Add a spec with the newer XLC output from our build systems. Signed-off-by: Tim Smith <tsmith@chef.io>
* Misc RuboCop cleanup of the codebaseTim Smith2020-11-2315-49/+43
| | | | | | A few misc things Signed-off-by: Tim Smith <tsmith@chef.io>
* Fix lpar name detectionlpar_detectionTim Smith2020-11-181-3/+1
| | | | | | LPAR partition names can have spaces in them, which is problematic with our previous split method which would throw away anything past the space. On our internal AIX cluster "virtlpar03 - 7.1 testers" became just "virtlpar03". Signed-off-by: Tim Smith <tsmith@chef.io>
* Merge pull request #1578 from chef/simplify_stripsTim Smith2020-11-1813-41/+39
|\ | | | | Signed-off-by: Tim Smith <tsmith@chef.io>
| * 1 line from_cmd in vmware as wellTim Smith2020-11-181-2/+1
| | | | | | | | Signed-off-by: Tim Smith <tsmith@chef.io>
| * Use strip instead of split($/) to cleanup shelloutTim Smith2020-11-1813-40/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` irb(main):008:0> "something\n ".split($/)[0] => "something" ``` ``` irb(main):009:0> "something\n ".strip => "something" ``` Calculating ------------------------------------- split_stuff 120.000 memsize ( 0.000 retained) 3.000 objects ( 0.000 retained) 2.000 strings ( 0.000 retained) strip_stuff 80.000 memsize ( 0.000 retained) 2.000 objects ( 0.000 retained) 2.000 strings ( 0.000 retained) Comparison: strip_stuff: 80 allocated split_stuff: 120 allocated - 1.50x more Warming up -------------------------------------- split_stuff 328.234k i/100ms strip_stuff 604.612k i/100ms Calculating ------------------------------------- split_stuff 3.648M (± 3.2%) i/s - 18.381M in 5.044570s strip_stuff 5.993M (± 2.8%) i/s - 30.231M in 5.048664s Comparison: strip_stuff: 5992617.3 i/s split_stuff: 3647589.6 i/s - 1.64x (± 0.00) slower Signed-off-by: Tim Smith <tsmith@chef.io>
* | Merge pull request #1577 from chef/simplify_kernelTim Smith2020-11-181-5/+5
|\ \ | |/ |/| Signed-off-by: Tim Smith <tsmith@chef.io>
| * Simplify the aix kernel pluginTim Smith2020-11-181-5/+5
| | | | | | | | | | | | | | There's no point in querying that we're on aix when we only execute this collect on aix. Just hard code it to aix for historic reasons. Signed-off-by: Tim Smith <tsmith@chef.io>
* | Gather wpar stateTim Smith2020-11-181-1/+4
| | | | | | | | | | | | This is an important thing to know about the wpars Signed-off-by: Tim Smith <tsmith@chef.io>
* | Simplify shellout and chompsTim Smith2020-11-181-3/+2
|/ | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Just set the aix platform / platform_family directlyTim Smith2020-11-181-2/+2
| | | | | | If we're in a collect block for aix then we're on aix. Signed-off-by: Tim Smith <tsmith@chef.io>
* Avoid calling uname 4 times on aixTim Smith2020-11-181-4/+6
| | | | | | Just get all the data we need and then split it. Signed-off-by: Tim Smith <tsmith@chef.io>
* Avoid running the regex for each lineTim Smith2020-11-181-6/+4
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Convert shellouts to grep to use regexes in Ruby insteadTim Smith2020-11-181-1/+1
| | | | | | This is significantly faster and having all the data in the specs makes it easier to refactor this later without having access to an AIX system. Signed-off-by: Tim Smith <tsmith@chef.io>
* Don't try to create the arp mash once each lineTim Smith2020-11-181-1/+1
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Simplify how we gather memory on AIXTim Smith2020-11-181-3/+3
| | | | | | The grep needs to get refactored away, but at least this way we avoid doing math on all the values we gather. Signed-off-by: Tim Smith <tsmith@chef.io>
* Use each_slice to further simplify key/value parsingTim Smith2020-11-181-3/+2
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* lin -> line variableTim Smith2020-11-181-8/+8
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Collapse down some shellout uses to avoid setting variablesTim Smith2020-11-181-4/+2
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Update the provides for this plugin to match other network pluginsTim Smith2020-11-181-1/+1
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Update lib/ohai/plugins/aix/network.rb Tim Smith2020-11-181-1/+1
| | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Avoid setting the addresses mash twiceTim Smith2020-11-181-2/+1
| | | | | | Just do it at the top of things Signed-off-by: Tim Smith <tsmith@chef.io>
* Refactor how we parse ifconfig in AIXTim Smith2020-11-181-28/+27
| | | | | | | | | | | There's a few different things going on here. - more descriptive variable names. Variables like splat were not very useful and others like iface actually held more than 1 value - replace a gsub and split with just a split on a regex from @phiggins - avoid the whole weird splat thing and ranges and instead just split each interface into the name and all the data. This makes the variables more clear when we use them throughout - avoid some positional math and just use shift to simply pop off the leading values to build the mash Signed-off-by: Tim Smith <tsmith@chef.io>
* Remove the :Joyent plugin as Joyent cloud went EOL 11/2019joyentTim Smith2020-11-171-78/+0
| | | | | | | | There's no reason to execute this plugin on every Ohai run. The Cloud is EOL. https://docs.joyent.com/joyent-public-cloud-eol/faq Signed-off-by: Tim Smith <tsmith@chef.io>
* Simplify all our splitsTim Smith2020-11-176-10/+10
| | | | | | | As Pete pointed out there's no need to split on whitespace when that's the default Signed-off-by: Tim Smith <tsmith@chef.io>
* Update lib/ohai/plugins/aix/network.rb Tim Smith2020-11-171-1/+1
| | | | | Signed-off-by: Tim Smith <tsmith@chef.io> Co-authored-by: pete higgins <pete@peterhiggins.org>
* Further optimize the netstat -rn parsingTim Smith2020-11-171-9/+7
| | | | | | This is up to 2x faster than the previous implementation Signed-off-by: Tim Smith <tsmith@chef.io>
* Fixes for test failuresTim Smith2020-11-171-2/+3
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Use .each_line vs. .lines.eachTim Smith2020-11-171-6/+6
| | | | | | This uses 2% less memory in my benchmarks Signed-off-by: Tim Smith <tsmith@chef.io>
* Use pure ruby vs. shelling out to grep to parse netstat dataTim Smith2020-11-171-7/+7
| | | | | | | | | | | Besides avoiding potentially pathing issues with grep this is faster: ``` Comparison: pure_ruby: 55.9 i/s grep: 41.6 i/s - 1.34x (± 0.00) slower ``` Signed-off-by: Tim Smith <tsmith@chef.io>
* Don't set network[:interfaces] to an empty mash when we set it laterTim Smith2020-11-171-1/+0
| | | | | | Avoid setting this twice. Signed-off-by: Tim Smith <tsmith@chef.io>
* Merge pull request #1561 from chef/lsbTim Smith2020-11-061-4/+4
|\ | | | | Signed-off-by: Tim Smith <tsmith@chef.io>
| * Remove the line anchor from the LSB plugin matcheslsbTim Smith2020-11-061-4/+4
| | | | | | | | | | | | These are 1 line at a time matches and we want everything until the end. There's no point in doing it this way. Signed-off-by: Tim Smith <tsmith@chef.io>
* | Merge pull request #1562 from chef/remove_legacy_lsbTim Smith2020-11-061-15/+1
|\ \ | | | | | | Remove Linux LSB support for systems without lsb-release CLI
| * | Remove Linux LSB support for systems with lsb-release CLIremove_legacy_lsbTim Smith2020-11-061-15/+1
| |/ | | | | | | | | | | This was something we did for legacy Debian < 7. Seems like we're good to nuke this at this point since we don't ship on anything less than 9 now. Signed-off-by: Tim Smith <tsmith@chef.io>
* | Remove regex anchors in the Linux Memory pluginmore_anchorsTim Smith2020-11-061-36/+36
|/ | | | | | | We're trying to match all everything here so we don't care about the end of the line. Signed-off-by: Tim Smith <tsmith@chef.io>
* Update lib/ohai/plugins/linux/hostnamectl.rb Tim Smith2020-11-061-1/+1
| | | | | Signed-off-by: Tim Smith <tsmith@chef.io> Co-authored-by: pete higgins <pete@peterhiggins.org>
* Update lib/ohai/plugins/linux/hostnamectl.rb Tim Smith2020-11-061-1/+1
| | | | | | | TIL you can limit the split. Thanks @ziggythehamster Signed-off-by: Tim Smith <tsmith@chef.io> Co-authored-by: Keith Gable <ziggy@ignition-project.com>
* Fix parsing of hostnamectl to support values with colonsfix_hostnamectlTim Smith2020-11-061-2/+2
| | | | | | This is probably faster too since we don't have to lstrip each result. Signed-off-by: Tim Smith <tsmith@chef.io>
* Collapse duplicate branches in case statementsTim Smith2020-11-062-6/+2
| | | | | | Simpler case statements Signed-off-by: Tim Smith <tsmith@chef.io>
* pop_os is a derivative of ubuntuChase Bolt2020-11-041-1/+1
| | | | Signed-off-by: Chase Bolt <chase.bolt@gmail.com>
* Check for the Rackspace kernel 3x fastermemoryTim Smith2020-10-311-1/+1
| | | | | | Also avoid creating an array while we do it Signed-off-by: Tim Smith <tsmith@chef.io>
* Use an array vs. appending a string in RubyTim Smith2020-10-311-2/+3
| | | | | | This is actually slightly faster too Signed-off-by: Tim Smith <tsmith@chef.io>
* Minor memory optimizationsTim Smith2020-10-3114-14/+16
| | | | | | Shave a bit more memory usage off Ohai Signed-off-by: Tim Smith <tsmith@chef.io>
* Merge branch 'master' into frozen_strings_v2Tim Smith2020-10-303-4/+4
|\
| * Merge pull request #1549 from chef/zpoolTim Smith2020-10-301-1/+1
| |\ | | | | | | Properly detect NVME/XVD devices in ZFS zpools
| | * Detect XVD disks as wellTim Smith2020-10-301-1/+1
| | | | | | | | | | | | Signed-off-by: Tim Smith <tsmith@chef.io>
| | * Properly detect NVME devices in ZFS zpoolsTim Smith2020-10-301-1/+1
| | | | | | | | | | | | | | | | | | Add another match in the zpool status regex and then update the existing unit test to have some NVME devices in it. Signed-off-by: Tim Smith <tsmith@chef.io>
| * | Split on strings intead of regex for 3x speedupTim Smith2020-10-302-3/+3
| |/ | | | | | | | | | | This is just over 3x faster than using the regex. Signed-off-by: Tim Smith <tsmith@chef.io>
* | Freeze the strings we're not later modifyingTim Smith2020-10-3099-0/+99
|/ | | | | | There's a few plugins that this couldn't be enabled on due to how we build strings, but for the most part this is an easy one to turn on and it shaves 1k from the runtime memory! Signed-off-by: Tim Smith <tsmith@chef.io>