aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakayoshi Tanaka <tatanaka@redhat.com>2017-11-09 06:48:51 +0000
committerBryn M. Reeves <bmr@redhat.com>2018-04-17 15:13:09 +0100
commitca755c2ee7b2ba8774b1f36555c6d9d39eeedff5 (patch)
treeb5ee0505aea7982319723d209f7cc6ff383048e5
parentcf12ad5381e72556e092173f6cb0b918020cb6db (diff)
downloadsos-ca755c2ee7b2ba8774b1f36555c6d9d39eeedff5.tar.gz
[azure] Added instance metadata and curl to RHUI if on demand image.
Instance metadat is useful to investigate the virtual machine properties. We will find the base image, size, location and so on from it. Also, connectivity to RHUI repo is required to work property for Azure RHEL On-Demand image. We fixed the WALinuxAgent package name type to enable this plugin by default when WALinuxAgent is running. It's usually running only on Azure. Resolves: #1145 Signed-off-by: Takayoshi Tanaka <tatanaka@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/azure.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/sos/plugins/azure.py b/sos/plugins/azure.py
index e3c2cecb..6cf4a294 100644
--- a/sos/plugins/azure.py
+++ b/sos/plugins/azure.py
@@ -15,15 +15,16 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from sos.plugins import Plugin, UbuntuPlugin, RedHatPlugin
+import os
-class Azure(Plugin, UbuntuPlugin, RedHatPlugin):
+class Azure(Plugin, UbuntuPlugin):
""" Microsoft Azure client
"""
plugin_name = 'azure'
profiles = ('virt',)
- packages = ('walinuxagent',)
+ packages = ('WALinuxAgent',)
def setup(self):
self.add_copy_spec([
@@ -35,4 +36,31 @@ class Azure(Plugin, UbuntuPlugin, RedHatPlugin):
"/sys/module/hv_storvsc/parameters/storvsc_ringbuffer_size"
])
+ self.add_cmd_output((
+ 'curl -s -H Metadata:true '
+ '"http://169.254.169.254/metadata/instance?'
+ 'api-version=2017-08-01"'
+ ), suggest_filename='instance_metadata.json')
+
+
+class RedHatAzure(Azure, RedHatPlugin):
+
+ def setup(self):
+ super(RedHatAzure, self).setup()
+
+ if os.path.isfile('/etc/yum.repos.d/rh-cloud.repo'):
+ curl_cmd = ('curl -s -m 5 -vvv '
+ 'https://rhui-%s.microsoft.com/pulp/repos/%s')
+ self.add_cmd_output([
+ curl_cmd % ('1', 'microsoft-azure-rhel7'),
+ curl_cmd % ('2', 'microsoft-azure-rhel7'),
+ curl_cmd % ('3', 'microsoft-azure-rhel7')
+ ])
+
+ crt_path = '/etc/pki/rhui/product/content.crt'
+ if os.path.isfile(crt_path):
+ self.add_cmd_output([
+ 'openssl x509 -noout -text -in ' + crt_path
+ ])
+
# vim: set et ts=4 sw=4 :