summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-17 19:41:41 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-17 19:41:41 -0800
commit983cb5b72e9ac303fc2a9d19f9abab0fbe07d978 (patch)
tree229e9d2d94244583b9a06478efafed1ecfcba917
parent999b3d4be6679e5fd4630cc795428e77c35fb66d (diff)
downloadohai-joyent.tar.gz
Remove the :Joyent plugin as Joyent cloud went EOL 11/2019joyent
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>
-rw-r--r--lib/ohai/plugins/joyent.rb78
-rw-r--r--spec/unit/plugins/joyent_spec.rb100
2 files changed, 0 insertions, 178 deletions
diff --git a/lib/ohai/plugins/joyent.rb b/lib/ohai/plugins/joyent.rb
deleted file mode 100644
index d68ec548..00000000
--- a/lib/ohai/plugins/joyent.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-# frozen_string_literal: true
-#
-# Author: sawanoboriyu@higanworks.com
-# Copyright (C) 2014 HiganWorks LLC
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-# Reference from: sm-summary command
-
-Ohai.plugin(:Joyent) do
- provides "joyent"
- provides "virtualization/guest_id"
- depends "os", "platform", "virtualization"
-
- def collect_product_file
- data = file_read("/etc/product") rescue nil
- if data
- data.strip.split("\n")
- else
- []
- end
- end
-
- def collect_pkgsrc
- data = file_read("/opt/local/etc/pkg_install.conf") rescue nil
- if data
- /PKG_PATH=(.*)/.match(data)[1] rescue nil
- end
- end
-
- def is_smartos?
- platform == "smartos"
- end
-
- collect_data do
- if is_smartos?
- joyent Mash.new
-
- # copy uuid
- joyent[:sm_uuid] = virtualization[:guest_uuid]
-
- # get zone id unless globalzone
- unless joyent[:sm_uuid] == "global"
- joyent[:sm_id] = virtualization[:guest_id]
- end
-
- # retrieve image name and pkgsrc
- collect_product_file.each do |line|
- case line
- when /^Image/
- sm_image = line.split
- joyent[:sm_image_id] = sm_image[1]
- joyent[:sm_image_ver] = sm_image[2]
- when /^Base Image/
- sm_baseimage = line.split
- joyent[:sm_baseimage_id] = sm_baseimage[2]
- joyent[:sm_baseimage_ver] = sm_baseimage[3]
- end
- end
-
- ## retrieve pkgsrc
- joyent[:sm_pkgsrc] = collect_pkgsrc
- end
- end
-end
diff --git a/spec/unit/plugins/joyent_spec.rb b/spec/unit/plugins/joyent_spec.rb
deleted file mode 100644
index b62aae5f..00000000
--- a/spec/unit/plugins/joyent_spec.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-#
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "spec_helper"
-
-describe Ohai::System, "plugin joyent" do
- let(:plugin) { get_plugin("joyent") }
-
- describe "without joyent" do
- before do
- allow(plugin).to receive(:is_smartos?).and_return(false)
- end
-
- it "DOES NOT create joyent mash" do
- plugin.run
- expect(plugin[:joyent]).to be_nil
- end
- end
-
- describe "with joyent" do
- before do
- allow(plugin).to receive(:is_smartos?).and_return(true)
- plugin[:virtualization] = Mash.new
- plugin[:virtualization][:guest_uuid] = "global"
- end
-
- it "creates joyent mash" do
- plugin.run
- expect(plugin[:joyent]).not_to be_nil
- end
-
- describe "under global zone" do
- before do
- plugin.run
- end
-
- it "detects global zone" do
- expect(plugin[:joyent][:sm_uuid]).to eql "global"
- end
-
- it "DOES NOT create sm_id" do
- expect(plugin[:joyent][:sm_id]).to be_nil
- end
- end
-
- describe "under smartmachine" do
- before do
- plugin[:virtualization][:guest_uuid] = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
- plugin[:virtualization][:guest_id] = "30"
-
- etc_product = <<~EOS
- Name: Joyent Instance
- Image: pkgbuild 16.3.1
- Documentation: https://docs.joyent.com/images/smartos/pkgbuild
- EOS
-
- pkg_install_conf = <<~EOS
- GPG_KEYRING_VERIFY=/opt/local/etc/gnupg/pkgsrc.gpg
- GPG_KEYRING_PKGVULN=/opt/local/share/gnupg/pkgsrc-security.gpg
- PKG_PATH=https://pkgsrc.joyent.com/packages/SmartOS/2016Q3/x86_64/All
- VERIFIED_INSTALLATION=trusted
- EOS
-
- allow(plugin).to receive(:file_read).with("/etc/product").and_return(etc_product)
- allow(plugin).to receive(:file_read).with("/opt/local/etc/pkg_install.conf").and_return(pkg_install_conf)
- plugin.run
- end
-
- it "retrieves zone uuid" do
- expect(plugin[:joyent][:sm_uuid]).to eql "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
- end
-
- it "collects sm_id" do
- expect(plugin[:joyent][:sm_id]).to eql "30"
- end
-
- it "collects images" do
- expect(plugin[:joyent][:sm_image_id]).to eql "pkgbuild"
- expect(plugin[:joyent][:sm_image_ver]).to eql "16.3.1"
- end
-
- it "collects pkgsrc" do
- expect(plugin[:joyent][:sm_pkgsrc]).to eql "https://pkgsrc.joyent.com/packages/SmartOS/2016Q3/x86_64/All"
- end
- end
- end
-end