xcat2 / xcat-inventory

An inventory tool for xcat cluster
8 stars 16 forks source link

support osdistro object #185

Closed immarvin closed 5 years ago

immarvin commented 5 years ago

this PR is to fix issue https://github.com/xcat2/xcat-inventory/issues/184:

UT result:

[root@briggs01 ~]# tabdump osdistro
#osdistroname,basename,majorversion,minorversion,arch,type,dirpaths,comments,disable
"rhels7.4-snap2-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-snap2/ppc64le",,
"rhels7.4-snap1-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-snap1/ppc64le",,
"rhels7.4-snap6-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-snap6/ppc64le",,
"ubuntu17.10-ppc64el","ubuntu","17","10","ppc64el","Linux","/install/ubuntu17.10/ppc64el",,
"rhels7.4-alternate-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-alternate/ppc64le",,
"rhels7.4-rc1-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-rc1/ppc64le",,
"rhels7.4-x86_64","rhels","7","4","x86_64","Linux","/install/rhels7.4/x86_64",,
"ubuntu16.04.2-ppc64el","ubuntu","16","04","ppc64el","Linux","/install/ubuntu16.04.2/ppc64el",,
"rhels7.4-mg-0GA_SP1-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-mg-0GA_SP1/ppc64le",,
"rhels7.4-pegas1.0GA_SP1-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-pegas1.0GA_SP1/ppc64le",,
"rhels7.4-pegas1_0GA_SP1-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-pegas1_0GA_SP1/ppc64le",,
"rhels7.4-pegas1.0GA.SP1-ppc64le","rhels","7","4","ppc64le","Linux","/install/rhels7.4-pegas1.0GA.SP1/ppc64le",,
"rhels7_4-pegas1_0GA_SP1-ppc64le","rhels","7",,"ppc64le","Linux","/install/rhels7_4-pegas1_0GA_SP1/ppc64le",,
"rhels7.5-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5/ppc64le,/install/REPO/os/rhels7.5/rhels7.5-rc3,/install/REPO/os/rhels/rhels7.5-rc3,/install/REPO/os/rhels/rhels7.5-rc3/ppc64le,/install/REPO/os/rhels/rhels7.5-ga/ppc64le",,
"rhels7.5-alternate-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-alternate/ppc64le,/install/REPO/os/rhels/rhels7.5-alt-GA,/install/REPO/os/rhels/rhels7.5-alt-ga/ppc64le",,
"rhels7.5-snap2-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-snap2/ppc64le",,
"rhels7.5-rc-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-rc/ppc64le",,
"rhels7.5-rc2-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-rc2/ppc64le",,
"rhels7.5-rc1-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-rc1/ppc64le",,
"rhels7.5-alt-rc1-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-alt-rc1/ppc64le",,
"rhels7.5-alt-rc2-vhu-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-alt-rc2-vhu/ppc64le",,
"rhels7.3-ppc64le","rhels","7","3","ppc64le","Linux","/install/rhels7.3/ppc64le",,
"rhels7.5-victor-testing-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-victor-testing/ppc64le",,
"rhels7.5-alt-rc2-ppc64le","rhels","7","5","ppc64le","Linux","/install/rhels7.5-alt-rc2/ppc64le",,
"cumulus3.4.1-armel","cumulus","3","4","armel","Linux","/install/cumulus3.4.1/armel",,
"rhels8.0-ppc64le","rhels","8","0","ppc64le","Linux","/install/rhels8.0/ppc64le",,
"ubuntu16.04.5-ppc64el","ubuntu","16","04","ppc64el","Linux","/install/ubuntu16.04.5/ppc64el",,
"cumulus3.5.2-armel","cumulus","3","5","armel","Linux","/install/cumulus3.5.2/armel",,
"rhels7.5-rc3-ppc64le","rhels","7","5","ppc64le","Linux","/install/REPO/os/rhels7.5",,
[root@briggs01 ~]#
[root@briggs01 ~]# xcat-inventory export -t osdistro
osdistro:
  cumulus3.4.1-armel:
    arch: armel
    basename: cumulus
    dirpaths: /install/cumulus3.4.1/armel
    majorversion: '3'
    minorversion: '4'
    type: Linux
  cumulus3.5.2-armel:
    arch: armel
    basename: cumulus
    dirpaths: /install/cumulus3.5.2/armel
    majorversion: '3'
    minorversion: '5'
    type: Linux
  rhels7.3-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.3/ppc64le
    majorversion: '7'
    minorversion: '3'
    type: Linux
  rhels7.4-alternate-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-alternate/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-mg-0GA_SP1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-mg-0GA_SP1/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-pegas1.0GA.SP1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-pegas1.0GA.SP1/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-pegas1.0GA_SP1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-pegas1.0GA_SP1/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-pegas1_0GA_SP1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-pegas1_0GA_SP1/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-rc1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-rc1/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-snap1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-snap1/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-snap2-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-snap2/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-snap6-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.4-snap6/ppc64le
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.4-x86_64:
    arch: x86_64
    basename: rhels
    dirpaths: /install/rhels7.4/x86_64
    majorversion: '7'
    minorversion: '4'
    type: Linux
  rhels7.5-alt-rc1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-alt-rc1/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-alt-rc2-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-alt-rc2/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-alt-rc2-vhu-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-alt-rc2-vhu/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-alternate-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-alternate/ppc64le,/install/REPO/os/rhels/rhels7.5-alt-GA,/install/REPO/os/rhels/rhels7.5-alt-ga/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5/ppc64le,/install/REPO/os/rhels7.5/rhels7.5-rc3,/install/REPO/os/rhels/rhels7.5-rc3,/install/REPO/os/rhels/rhels7.5-rc3/ppc64le,/install/REPO/os/rhels/rhels7.5-ga/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-rc-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-rc/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-rc1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-rc1/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-rc2-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-rc2/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-rc3-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/REPO/os/rhels7.5
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-snap2-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-snap2/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7.5-victor-testing-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7.5-victor-testing/ppc64le
    majorversion: '7'
    minorversion: '5'
    type: Linux
  rhels7_4-pegas1_0GA_SP1-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels7_4-pegas1_0GA_SP1/ppc64le
    majorversion: '7'
    type: Linux
  rhels8.0-ppc64le:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/rhels8.0/ppc64le
    majorversion: '8'
    minorversion: '0'
    type: Linux
  ubuntu16.04.2-ppc64el:
    arch: ppc64el
    basename: ubuntu
    dirpaths: /install/ubuntu16.04.2/ppc64el
    majorversion: '16'
    minorversion: '04'
    type: Linux
  ubuntu16.04.5-ppc64el:
    arch: ppc64el
    basename: ubuntu
    dirpaths: /install/ubuntu16.04.5/ppc64el
    majorversion: '16'
    minorversion: '04'
    type: Linux
  ubuntu17.10-ppc64el:
    arch: ppc64el
    basename: ubuntu
    dirpaths: /install/ubuntu17.10/ppc64el
    majorversion: '17'
    minorversion: '10'
    type: Linux
schema_version: '2.0'

#Version 2.14.6 (git commit c76c3c0d451c42cae3c726e158cfebbfcc37e0bf, built Wed Jan 16 06:16:24 EST 2019)
[root@briggs01 ~]#
immarvin commented 5 years ago

import UT:

[root@briggs01 ~]# cat /tmp/new
osdistro:
  new:
    arch: ppc64le
    basename: rhels
    dirpaths: /install/REPO/os/rhels7.5
    majorversion: '7'
    minorversion: '5'
    type: Linux
schema_version: '2.0'

#Version 2.14.6 (git commit c76c3c0d451c42cae3c726e158cfebbfcc37e0bf, built Wed Jan 16 06:16:24 EST 2019)
[root@briggs01 ~]#
[root@briggs01 ~]# xcat-inventory import -f /tmp/new
loading inventory date in "/tmp/new"
start to import "osdistro" type objects
 preprocessing "osdistro" type objects
 writting "osdistro" type objects
Inventory import successfully!
[root@briggs01 ~]# lsdef -t osdistro -o new
Object name: new
    arch=ppc64le
    basename=rhels
    dirpaths=/install/REPO/os/rhels7.5
    majorversion=7
    minorversion=5
    type=Linux