Example #1
0
  def test_get_os_major_version(self, mock_linux_distribution):

    # 1
    mock_linux_distribution.return_value = ('', '123.45.67', '')
    result = OSCheck.get_os_major_version()
    self.assertEquals(result, '123')

    # 2
    mock_linux_distribution.return_value = ('Suse', '11', '')
    result = OSCheck.get_os_major_version()
    self.assertEquals(result, '11')
Example #2
0
    def os_major_version(self):
        """
    Example return value:
    "6" for "Centos 6.3"

    In case cannot detect --> Fail
    """
        return OSCheck.get_os_major_version()
Example #3
0
def main(argv=None):
    # Same logic that was in "os_type_check.sh"
    if len(sys.argv) != 2:
        print "Usage: <cluster_os>"
        raise Exception("Error in number of arguments. Usage: <cluster_os>")
        pass

    cluster_os = sys.argv[1]
    current_os = OSCheck.get_os_family() + OSCheck.get_os_major_version()

    # If agent/server have the same {"family","main_version"} - then ok.
    print "Cluster primary/cluster OS type is %s and local/current OS type is %s" % (
        cluster_os, current_os)
    if current_os == cluster_os:
        sys.exit(0)
    else:
        raise Exception(
            "Local OS is not compatible with cluster primary OS. Please perform manual bootstrap on this host."
        )