Hello community, here is the log from the commit of package salt-shaptools for openSUSE:Factory checked in at 2020-01-10 17:51:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/salt-shaptools (Old) and /work/SRC/openSUSE:Factory/.salt-shaptools.new.6675 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "salt-shaptools" Fri Jan 10 17:51:42 2020 rev:9 rq:762852 version:0.2.12 Changes: -------- --- /work/SRC/openSUSE:Factory/salt-shaptools/salt-shaptools.changes 2019-12-23 22:48:57.218101090 +0100 +++ /work/SRC/openSUSE:Factory/.salt-shaptools.new.6675/salt-shaptools.changes 2020-01-10 17:51:46.578134140 +0100 @@ -1,0 +2,18 @@ +Thu Jan 9 15:28:29 UTC 2020 - Simranpal Singh <[email protected]> + +- Version 0.2.12 + * Add module fn to update nw installation conf files + +------------------------------------------------------------------- +Wed Jan 8 16:45:18 UTC 2020 - Simranpal Singh <[email protected]> + +- Version 0.2.11 + * Add functionality to install hana with xml passwords file + +------------------------------------------------------------------- +Wed Jan 08 10:16:53 UTC 2020 - Xabier Arbulu <[email protected]> + +- Version 0.2.10 + Add crmsh --no-overwrite-sshkeys option + +------------------------------------------------------------------- Old: ---- salt-shaptools-0.2.9.tar.gz New: ---- salt-shaptools-0.2.12.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ salt-shaptools.spec ++++++ --- /var/tmp/diff_new_pack.MZ0Ik3/_old 2020-01-10 17:51:47.342134524 +0100 +++ /var/tmp/diff_new_pack.MZ0Ik3/_new 2020-01-10 17:51:47.342134524 +0100 @@ -19,7 +19,7 @@ # See also https://en.opensuse.org/openSUSE:Specfile_guidelines Name: salt-shaptools -Version: 0.2.9 +Version: 0.2.12 Release: 0 Summary: Salt modules and states for SAP Applications and SLE-HA components management ++++++ salt-shaptools-0.2.9.tar.gz -> salt-shaptools-0.2.12.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/salt/__init__.py new/salt-shaptools-0.2.12/salt/__init__.py --- old/salt-shaptools-0.2.9/salt/__init__.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/salt/__init__.py 2020-01-09 16:37:15.619797345 +0100 @@ -6,4 +6,4 @@ :since: 2018-11-30 """ -__version__ = "0.2.7" +__version__ = "0.2.11" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/salt/modules/crmshmod.py new/salt-shaptools-0.2.12/salt/modules/crmshmod.py --- old/salt-shaptools-0.2.9/salt/modules/crmshmod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/salt/modules/crmshmod.py 2020-01-09 16:37:15.619797345 +0100 @@ -288,6 +288,7 @@ admin_ip=None, sbd=None, sbd_dev=None, + no_overwrite_sshkey=False, quiet=None): ''' crm cluster init command execution @@ -307,6 +308,8 @@ if sbd_dev: sbd_str = ' '.join(['-s {}'.format(sbd) for sbd in sbd_dev]) cmd = '{cmd} {sbd_str}'.format(cmd=cmd, sbd_str=sbd_str) + if no_overwrite_sshkey: + cmd = '{cmd} --no-overwrite-sshkey'.format(cmd=cmd) if quiet: cmd = '{cmd} -q'.format(cmd=cmd) @@ -395,6 +398,7 @@ admin_ip=None, sbd=None, sbd_dev=None, + no_overwrite_sshkey=False, quiet=None): ''' Initialize a cluster from scratch. @@ -416,6 +420,9 @@ sbd_dev sbd device path. To be used "sbd" parameter must be used too. If None, the sbd is set as diskless. + no_overwrite_sshkey + No overwrite the currently existing sshkey (/root/.ssh/id_rsa) + Only available after crmsh 3.0.0 quiet: execute the command in quiet mode (no output) @@ -432,9 +439,11 @@ # and create the corresponing UT if __salt__['crm.use_crm']: return _crm_init( - name, watchdog, interface, unicast, admin_ip, sbd, sbd_dev, quiet) + name, watchdog, interface, unicast, admin_ip, sbd, sbd_dev, no_overwrite_sshkey, quiet) LOGGER.warning('The parameter name is not considered!') + LOGGER.warning('--no_overwrite_sshkey option not available') + return _ha_cluster_init( watchdog, interface, unicast, admin_ip, sbd, sbd_dev, quiet) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/salt/modules/hanamod.py new/salt-shaptools-0.2.12/salt/modules/hanamod.py --- old/salt-shaptools-0.2.9/salt/modules/hanamod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/salt/modules/hanamod.py 2020-01-09 16:37:15.619797345 +0100 @@ -162,12 +162,37 @@ except IOError as err: raise exceptions.CommandExecutionError(err) +def update_hdb_pwd_file( + hdb_pwd_file, + **extra_parameters): + ''' + Update SAP HANA XML password file + + hdb_pwd_file + Path to the existing XML password file + extra_parameters (dict): Dictionary with the values to be updated. Use the exact + name of the SAP XML password file for the key + + Returns: + str: XML password file path + + CLI Example: + + .. code-block:: bash + + salt '*' hana.update_hdb_pwd_file /root /root/hdb_passwords.xml sapadm_password=DummyPasswd + ''' + try: + return hana.HanaInstance.update_hdb_pwd_file(hdb_pwd_file, **extra_parameters) + except IOError as err: + raise exceptions.CommandExecutionError(err) def install( software_path, conf_file, root_user, - root_password): + root_password, + hdb_pwd_file=None): ''' Install SAP HANA with configuration file @@ -179,16 +204,17 @@ Root user name root_password Root user password - + hdb_pwd_file + Path where XML password file exists(optional) CLI Example: .. code-block:: bash - salt '*' hana.install /installation_path /home/myuser/hana.conf root root + salt '*' hana.install /installation_path /home/myuser/hana.conf root root /root/hdb_passwords.xml ''' try: hana.HanaInstance.install( - software_path, conf_file, root_user, root_password) + software_path, conf_file, root_user, root_password, hdb_pwd_file) except hana.HanaError as err: raise exceptions.CommandExecutionError(err) @@ -874,4 +900,4 @@ raise exceptions.CommandExecutionError( 'HANA database not available after {} seconds in {}:{}'.format( timeout, host, port - )) + )) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/salt/modules/netweavermod.py new/salt-shaptools-0.2.12/salt/modules/netweavermod.py --- old/salt-shaptools-0.2.9/salt/modules/netweavermod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/salt/modules/netweavermod.py 2020-01-09 16:37:15.619797345 +0100 @@ -260,6 +260,30 @@ return ip_address +def update_conf_file( + conf_file, + **extra_parameters): + ''' + Update SAP Netweaver installation configuration file + + conf_file + Path to the existing configuration file + extra_parameters (dict): Dictionary with the values to be updated. Use the exact + name of the SAP configuration file for the key + + Returns: + str: Configuration file path + + CLI Example: + + .. code-block:: bash + + salt '*' netweaver.update_conf_file /tmp/nw.inifile.params sid=HA1 + ''' + try: + return netweaver.NetweaverInstance.update_conf_file(conf_file, **extra_parameters) + except IOError as err: + raise exceptions.CommandExecutionError(err) def install( software_path, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/salt/states/crmshmod.py new/salt-shaptools-0.2.12/salt/states/crmshmod.py --- old/salt-shaptools-0.2.9/salt/states/crmshmod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/salt/states/crmshmod.py 2020-01-09 16:37:15.619797345 +0100 @@ -104,6 +104,7 @@ admin_ip=None, sbd=None, sbd_dev=None, + no_overwrite_sshkey=False, quiet=None): """ Machine is running a cluster node @@ -124,6 +125,9 @@ sbd device path. To be used "sbd" parameter must be used too. If None, the sbd is set as diskless. This parameter can be a string (meaning one disk) or a list with multiple disks + no_overwrite_sshkey + No overwrite the currently existing sshkey (/root/.ssh/id_rsa) + Only available after crmsh 3.0.0 quiet: execute the command in quiet mode (no output) """ @@ -153,6 +157,7 @@ admin_ip=admin_ip, sbd=sbd, sbd_dev=sbd_dev, + no_overwrite_sshkey=no_overwrite_sshkey, quiet=quiet) if result: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/salt/states/hanamod.py new/salt-shaptools-0.2.12/salt/states/hanamod.py --- old/salt-shaptools-0.2.9/salt/states/hanamod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/salt/states/hanamod.py 2020-01-09 16:37:15.619797345 +0100 @@ -67,6 +67,7 @@ __virtualname__ = 'hana' TMP_CONFIG_FILE = '/tmp/hana.conf' +TMP_HDB_PWD_FILE = '/root/hdb_passwords.xml' INI_PARAM_PRELOAD_CS = {'section_name': 'system_replication', 'parameter_name': 'preload_column_tables'} INI_PARAM_GAL = {'section_name': 'memorymanager', 'parameter_name': 'global_allocation_limit'} @@ -150,6 +151,8 @@ root_user, root_password, config_file=None, + hdb_pwd_file=None, + remove_pwd_files=True, sapadm_password=None, system_user_password=None, extra_parameters={}): @@ -177,11 +180,18 @@ to the minion and used in the installation. Values in this file might be changed setting then in the extra_parameters dictionary using the exact name as in the config file as a key + hdb_pwd_file + If hdb_pwd_file paremeter is set, it will be downloaded from the master + to the minion and used in the installation. Values in this file might + be changed setting then in the extra_parameters dictionary using the + exact name as in the XML file as a key + remove_pwd_files + If remove the XML password hdb_pwd_file after installation. True by default sapadm_password - If the config file is not set, the sapadm_password is mandatory. The + If the password in config file or hdb_pwd_file is not set, the sapadm_password is mandatory. The password of the sap administrator user system_user_password - If the config file is not set, the system_user_password is mandatory. The + If the password in config file or hdb_pwd_file is not set, the system_user_password is mandatory. The password of the database SYSTEM (superuser) user extra_parameters Optional configuration parameters (exact name as in the config file as a key) @@ -209,31 +219,45 @@ try: # Here starts the actual process + temp_file = __salt__['hana.create_conf_file']( + software_path=software_path, + conf_file=TMP_CONFIG_FILE, + root_user=root_user, + root_password=root_password) + if hdb_pwd_file: + __salt__['cp.get_file']( + path=hdb_pwd_file, + dest=TMP_HDB_PWD_FILE) + ret['changes']['hdb_pwd_file'] = hdb_pwd_file + hdb_pwd_file = TMP_HDB_PWD_FILE + elif system_user_password is None or sapadm_password is None: + ret['comment'] = 'If XML password file is not provided '\ + 'system_user_password and sapadm_password are mandatory' + return ret + else: + pwd_file = '{}.xml'.format(TMP_CONFIG_FILE) + __salt__['file.move']( + src=pwd_file, + dst=TMP_HDB_PWD_FILE) + hdb_pwd_file = __salt__['hana.update_hdb_pwd_file']( + hdb_pwd_file=TMP_HDB_PWD_FILE, + root_password=root_password, + password=password, + sapadm_password=sapadm_password, + system_user_password=system_user_password) + ret['changes']['hdb_pwd_file'] = 'new' if config_file: __salt__['cp.get_file']( path=config_file, dest=TMP_CONFIG_FILE) ret['changes']['config_file'] = config_file config_file = TMP_CONFIG_FILE - elif system_user_password is None or sapadm_password is None: - ret['comment'] = 'If config_file is not provided '\ - 'system_user_password and sapadm_password are mandatory' - return ret else: - config_file = __salt__['hana.create_conf_file']( - software_path=software_path, - conf_file=TMP_CONFIG_FILE, - root_user=root_user, - root_password=root_password) config_file = __salt__['hana.update_conf_file']( - conf_file=config_file, + conf_file=temp_file, sid=sid.upper(), - password=password, number='{:0>2}'.format(inst), - root_user=root_user, - root_password=root_password, - sapadm_password=sapadm_password, - system_user_password=system_user_password) + root_user=root_user) ret['changes']['config_file'] = 'new' if extra_parameters: extra_parameters = _parse_dict(extra_parameters) @@ -244,8 +268,11 @@ __salt__['hana.install']( software_path=software_path, conf_file=config_file, + hdb_pwd_file=hdb_pwd_file, root_user=root_user, root_password=root_password) + if remove_pwd_files: + __salt__['file.remove'](hdb_pwd_file) ret['changes']['sid'] = sid ret['comment'] = 'HANA installed' ret['result'] = True @@ -255,7 +282,6 @@ ret['comment'] = six.text_type(err) return ret finally: - __salt__['file.remove'](TMP_CONFIG_FILE) __salt__['file.remove']('{}.xml'.format(TMP_CONFIG_FILE)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/salt-shaptools.changes new/salt-shaptools-0.2.12/salt-shaptools.changes --- old/salt-shaptools-0.2.9/salt-shaptools.changes 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/salt-shaptools.changes 2020-01-09 16:37:15.619797345 +0100 @@ -1,4 +1,22 @@ ------------------------------------------------------------------- +Thu Jan 9 15:28:29 UTC 2020 - Simranpal Singh <[email protected]> + +- Version 0.2.12 + * Add module fn to update nw installation conf files + +------------------------------------------------------------------- +Wed Jan 8 16:45:18 UTC 2020 - Simranpal Singh <[email protected]> + +- Version 0.2.11 + * Add functionality to install hana with xml passwords file + +------------------------------------------------------------------- +Wed Jan 08 10:16:53 UTC 2020 - Xabier Arbulu <[email protected]> + +- Version 0.2.10 + Add crmsh --no-overwrite-sshkeys option + +------------------------------------------------------------------- Mon Dec 23 07:39:31 UTC 2019 - nick wang <[email protected]> - Version 0.2.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/salt-shaptools.spec new/salt-shaptools-0.2.12/salt-shaptools.spec --- old/salt-shaptools-0.2.9/salt-shaptools.spec 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/salt-shaptools.spec 2020-01-09 16:37:15.619797345 +0100 @@ -19,7 +19,7 @@ # See also https://en.opensuse.org/openSUSE:Specfile_guidelines Name: salt-shaptools -Version: 0.2.9 +Version: 0.2.12 Release: 0 Summary: Salt modules and states for SAP Applications and SLE-HA components management diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/tests/unit/modules/test_crmshmod.py new/salt-shaptools-0.2.12/tests/unit/modules/test_crmshmod.py --- old/salt-shaptools-0.2.9/tests/unit/modules/test_crmshmod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/tests/unit/modules/test_crmshmod.py 2020-01-09 16:37:15.619797345 +0100 @@ -352,11 +352,11 @@ with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}): result = crmshmod._crm_init( - 'hacluster', 'dog', 'eth1', True, '192.168.1.50', True, ['dev1', 'dev2'], True) + 'hacluster', 'dog', 'eth1', True, '192.168.1.50', True, ['dev1', 'dev2'], True, True) assert result mock_cmd_run.assert_called_once_with( '{} cluster init -y -n {} -w {} -i {} -u -A {} ' - '--enable-sbd -s {} -s {} -q'.format( + '--enable-sbd -s {} -s {} --no-overwrite-sshkey -q'.format( crmshmod.CRM_COMMAND, 'hacluster', 'dog', 'eth1', '192.168.1.50', 'dev1', 'dev2')) def test_ha_cluster_init_basic(self): @@ -467,7 +467,7 @@ value = crmshmod.cluster_init('hacluster', 'dog', 'eth1') assert value == 0 crm_init.assert_called_once_with( - 'hacluster', 'dog', 'eth1', None, None, 'sbd', 'devs', None) + 'hacluster', 'dog', 'eth1', None, None, 'sbd', 'devs', False, None) crm_init.reset_mock() with patch.dict(crmshmod.__salt__, {'crm.use_crm': True}): @@ -475,7 +475,7 @@ value = crmshmod.cluster_init('hacluster', 'dog', 'eth1', sbd_dev=['disk1', 'disk2']) assert value == 0 crm_init.assert_called_once_with( - 'hacluster', 'dog', 'eth1', None, None, 'sbd', 'devs', None) + 'hacluster', 'dog', 'eth1', None, None, 'sbd', 'devs', False, None) crm_init.reset_mock() with patch.dict(crmshmod.__salt__, {'crm.use_crm': True}): @@ -483,7 +483,7 @@ value = crmshmod.cluster_init('hacluster', 'dog', 'eth1', sbd_dev='disk1') assert value == 0 crm_init.assert_called_once_with( - 'hacluster', 'dog', 'eth1', None, None, 'sbd', 'devs', None) + 'hacluster', 'dog', 'eth1', None, None, 'sbd', 'devs', False, None) @mock.patch('logging.Logger.warning') @mock.patch('salt.modules.crmshmod._manage_multiple_sbd') @@ -496,10 +496,13 @@ with patch.dict(crmshmod.__salt__, {'crm.use_crm': False}): ha_cluster_init.return_value = 0 - value = crmshmod.cluster_init('hacluster', 'dog', 'eth1') + value = crmshmod.cluster_init( + 'hacluster', 'dog', 'eth1', no_overwrite_sshkey=True) assert value == 0 - logger.assert_called_once_with( - 'The parameter name is not considered!') + logger.assert_has_calls([ + mock.call('The parameter name is not considered!'), + mock.call('--no_overwrite_sshkey option not available') + ]) ha_cluster_init.assert_called_once_with( 'dog', 'eth1', None, None, 'sbd', 'devs', None) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/tests/unit/modules/test_hanamod.py new/salt-shaptools-0.2.12/tests/unit/modules/test_hanamod.py --- old/salt-shaptools-0.2.9/tests/unit/modules/test_hanamod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/tests/unit/modules/test_hanamod.py 2020-01-09 16:37:15.619797345 +0100 @@ -155,15 +155,39 @@ assert 'hana error' in str(err.value) @patch('salt.modules.hanamod.hana.HanaInstance') + def test_update_hdb_pwd_file_return(self, mock_hana): + ''' + Test update_hdb_pwd_file method - return + ''' + mock_hana.update_hdb_pwd_file.return_value = 'hana.conf.xml' + hdb_pwd_file = hanamod.update_hdb_pwd_file( + 'hana.conf.xml', sapadm_password='Test1234', system_user_password='Syst1234') + assert u'hana.conf.xml' == hdb_pwd_file + mock_hana.update_hdb_pwd_file.assert_called_once_with( + 'hana.conf.xml', sapadm_password='Test1234', system_user_password='Syst1234') + + @patch('salt.modules.hanamod.hana.HanaInstance') + def test_update_hdb_pwd_file_raise(self, mock_hana): + ''' + Test update_hdb_pwd_file method - raise + ''' + mock_hana.update_hdb_pwd_file.side_effect = IOError('hana error') + with pytest.raises(exceptions.CommandExecutionError) as err: + hanamod.update_hdb_pwd_file('hana.conf.xml', sapadm_password='Test1234', system_user_password='Syst1234') + mock_hana.update_hdb_pwd_file.assert_called_once_with( + 'hana.conf.xml', sapadm_password='Test1234', system_user_password='Syst1234') + assert 'hana error' in str(err.value) + + @patch('salt.modules.hanamod.hana.HanaInstance') def test_install_return(self, mock_hana): ''' Test install method - return ''' mock_hana.install.return_value = 'hana.conf' hanamod.install( - 'software_path', 'hana.conf', 'root', 'root') + 'software_path', 'hana.conf', 'root', 'root', 'hana.conf.xml') mock_hana.install.assert_called_once_with( - 'software_path', 'hana.conf', 'root', 'root') + 'software_path', 'hana.conf', 'root', 'root', 'hana.conf.xml') @patch('salt.modules.hanamod.hana.HanaInstance') def test_install_raise(self, mock_hana): @@ -174,9 +198,9 @@ 'hana error' ) with pytest.raises(exceptions.CommandExecutionError) as err: - hanamod.install('software_path', 'hana.conf', 'root', 'root') + hanamod.install('software_path', 'hana.conf', 'root', 'root', 'hana.conf.xml') mock_hana.install.assert_called_once_with( - 'software_path', 'hana.conf', 'root', 'root') + 'software_path', 'hana.conf', 'root', 'root', 'hana.conf.xml') assert 'hana error' in str(err.value) def test_uninstall_return(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/tests/unit/modules/test_netweavermod.py new/salt-shaptools-0.2.12/tests/unit/modules/test_netweavermod.py --- old/salt-shaptools-0.2.9/tests/unit/modules/test_netweavermod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/tests/unit/modules/test_netweavermod.py 2020-01-09 16:37:15.619797345 +0100 @@ -312,6 +312,30 @@ assert 'error running "ip address" command' in str(err.value) @patch('salt.modules.netweavermod.netweaver.NetweaverInstance') + def test_update_conf_file(self, mock_netweaver): + ''' + Test update_conf_file method - return + ''' + mock_netweaver.update_conf_file.return_value = 'nw.inifile.params' + conf_file = netweavermod.update_conf_file( + 'nw.inifile.params', sid='HA1', masterPwd='Suse1234') + assert u'nw.inifile.params' == conf_file + mock_netweaver.update_conf_file.assert_called_once_with( + 'nw.inifile.params', sid='HA1', masterPwd='Suse1234') + + @patch('salt.modules.netweavermod.netweaver.NetweaverInstance') + def test_update_conf_file_raise(self, mock_netweaver): + ''' + Test update_conf_file method - raise + ''' + mock_netweaver.update_conf_file.side_effect = IOError('netweaver error') + with pytest.raises(exceptions.CommandExecutionError) as err: + netweavermod.update_conf_file('nw.inifile.params', sid='HA1', masterPwd='Suse1234') + mock_netweaver.update_conf_file.assert_called_once_with( + 'nw.inifile.params', sid='HA1', masterPwd='Suse1234') + assert 'netweaver error' in str(err.value) + + @patch('salt.modules.netweavermod.netweaver.NetweaverInstance') def test_install(self, mock_netweaver): ''' Test install method - return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/tests/unit/states/test_crmshmod.py new/salt-shaptools-0.2.12/tests/unit/states/test_crmshmod.py --- old/salt-shaptools-0.2.9/tests/unit/states/test_crmshmod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/tests/unit/states/test_crmshmod.py 2020-01-09 16:37:15.619797345 +0100 @@ -177,6 +177,7 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + no_overwrite_sshkey=True, quiet=False) == ret mock_status.assert_called_once_with() mock_init.assert_called_once_with( @@ -187,6 +188,7 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + no_overwrite_sshkey=True, quiet=False) def test_initialized_error(self): @@ -211,6 +213,7 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + no_overwrite_sshkey=True, quiet=False) == ret mock_status.assert_called_once_with() mock_init.assert_called_once_with( @@ -221,6 +224,7 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + no_overwrite_sshkey=True, quiet=False) def test_initialized_command_error(self): @@ -246,6 +250,7 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + no_overwrite_sshkey=False, quiet=False) == ret mock_status.assert_called_once_with() mock_init.assert_called_once_with( @@ -256,6 +261,7 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + no_overwrite_sshkey=False, quiet=False) # 'joined' function tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.2.9/tests/unit/states/test_hanamod.py new/salt-shaptools-0.2.12/tests/unit/states/test_hanamod.py --- old/salt-shaptools-0.2.9/tests/unit/states/test_hanamod.py 2019-12-23 09:51:40.024493544 +0100 +++ new/salt-shaptools-0.2.12/tests/unit/states/test_hanamod.py 2020-01-09 16:37:15.619797345 +0100 @@ -130,29 +130,47 @@ def test_installed_config_file(self): ''' - Test to check installed when config file is imported + Test to check installed when config file is imported and XML password file is created ''' ret = {'name': 'prd', - 'changes': {'sid': 'prd', 'config_file': 'hana.conf'}, + 'changes': {'sid': 'prd', 'config_file': 'hana.conf', 'hdb_pwd_file': 'new'}, 'result': True, 'comment': 'HANA installed'} mock_installed = MagicMock(return_value=False) mock_cp = MagicMock() + mock_mv = MagicMock() + mock_create_xml = MagicMock(return_value='temp.conf') + mock_update_xml = MagicMock(return_value=hanamod.TMP_HDB_PWD_FILE) mock_update = MagicMock(return_value='hana_updated.conf') mock_install = MagicMock() mock_remove = MagicMock() with patch.dict(hanamod.__salt__, {'hana.is_installed': mock_installed, 'cp.get_file': mock_cp, + 'file.move': mock_mv, + 'hana.create_conf_file': mock_create_xml, + 'hana.update_hdb_pwd_file':mock_update_xml, 'hana.update_conf_file': mock_update, 'hana.install': mock_install, 'file.remove': mock_remove}): assert hanamod.installed( 'prd', '00', 'pass', '/software', - 'root', 'pass', config_file='hana.conf', + 'root', config_file='hana.conf', root_password='Test1234', + sapadm_password='Test1234', system_user_password='Test1234', extra_parameters=[{'hostname': 'hana01'}]) == ret + mock_create_xml.assert_called_once_with( + software_path='/software', + conf_file=hanamod.TMP_CONFIG_FILE, + root_user='root', + root_password='Test1234') + mock_mv.assert_called_once_with( + src='/tmp/hana.conf.xml', + dst=hanamod.TMP_HDB_PWD_FILE) + mock_update_xml.assert_called_once_with( + hdb_pwd_file=hanamod.TMP_HDB_PWD_FILE, root_password='Test1234', + password='pass', sapadm_password='Test1234', system_user_password='Test1234') mock_cp.assert_called_once_with( path='hana.conf', dest=hanamod.TMP_CONFIG_FILE) @@ -162,29 +180,30 @@ mock_install.assert_called_once_with( software_path='/software', conf_file='hana_updated.conf', - root_user='root', - root_password='pass') + root_user='root', root_password='Test1234', + hdb_pwd_file=hanamod.TMP_HDB_PWD_FILE) mock_remove.assert_has_calls([ - mock.call(hanamod.TMP_CONFIG_FILE), mock.call('{}.xml'.format(hanamod.TMP_CONFIG_FILE)) ]) def test_installed_dump(self): ''' - Test to check installed when new config file is created + Test to check installed when new config file is created and XML password file is imported ''' ret = {'name': 'prd', - 'changes': {'sid': 'prd', 'config_file': 'new'}, + 'changes': {'sid': 'prd', 'config_file': 'new', 'hdb_pwd_file': 'passwords.xml'}, 'result': True, 'comment': 'HANA installed'} mock_installed = MagicMock(return_value=False) + mock_cp = MagicMock() mock_create = MagicMock(return_value='hana_created.conf') mock_update = MagicMock(return_value='hana_updated.conf') mock_install = MagicMock() mock_remove = MagicMock() with patch.dict(hanamod.__salt__, {'hana.is_installed': mock_installed, + 'cp.get_file': mock_cp, 'hana.create_conf_file': mock_create, 'hana.update_conf_file': mock_update, 'hana.install': mock_install, @@ -192,10 +211,12 @@ assert hanamod.installed( 'prd', 0, 'pass', '/software', 'root', 'pass', - system_user_password='sys_pass', - sapadm_password='pass', + hdb_pwd_file='passwords.xml', extra_parameters=[{'hostname': 'hana01'}]) == ret + mock_cp.assert_called_once_with( + path='passwords.xml', + dest=hanamod.TMP_HDB_PWD_FILE) mock_create.assert_called_once_with( software_path='/software', conf_file=hanamod.TMP_CONFIG_FILE, @@ -204,8 +225,7 @@ mock_update.assert_has_calls([ mock.call( conf_file='hana_created.conf', sid='PRD', number='00', - password='pass', root_user='root', root_password='pass', - sapadm_password='pass', system_user_password='sys_pass'), + root_user='root'), mock.call( conf_file='hana_updated.conf', extra_parameters={u'hostname': u'hana01'}) @@ -215,9 +235,9 @@ software_path='/software', conf_file='hana_updated.conf', root_user='root', - root_password='pass') + root_password='pass', + hdb_pwd_file=hanamod.TMP_HDB_PWD_FILE) mock_remove.assert_has_calls([ - mock.call(hanamod.TMP_CONFIG_FILE), mock.call('{}.xml'.format(hanamod.TMP_CONFIG_FILE)) ]) @@ -229,20 +249,27 @@ ret = {'name': 'prd', 'changes': {}, 'result': False, - 'comment': 'If config_file is not provided ' + 'comment': 'If XML password file is not provided ' 'system_user_password and sapadm_password are mandatory'} mock_installed = MagicMock(return_value=False) + mock_create = MagicMock(return_value='hana_created.conf') mock_remove = MagicMock() with patch.dict(hanamod.__salt__, {'hana.is_installed': mock_installed, + 'hana.create_conf_file': mock_create, 'file.remove': mock_remove}): assert hanamod.installed( 'prd', '00', 'pass', '/software', 'root', 'pass') == ret + + mock_create.assert_called_once_with( + software_path='/software', + conf_file=hanamod.TMP_CONFIG_FILE, + root_user='root', + root_password='pass') mock_remove.assert_has_calls([ - mock.call(hanamod.TMP_CONFIG_FILE), mock.call('{}.xml'.format(hanamod.TMP_CONFIG_FILE)) ]) @@ -252,44 +279,46 @@ ''' ret = {'name': 'prd', - 'changes': {'config_file': 'new'}, + 'changes': {'config_file': 'new', 'hdb_pwd_file': 'passwords.xml'}, 'result': False, 'comment': 'hana command error'} mock_installed = MagicMock(return_value=False) + mock_cp = MagicMock() mock_create = MagicMock(return_value='hana_created.conf') mock_update = MagicMock(return_value='hana_updated.conf') mock_install = MagicMock( side_effect=exceptions.CommandExecutionError('hana command error')) mock_remove = MagicMock() with patch.dict(hanamod.__salt__, {'hana.is_installed': mock_installed, + 'cp.get_file': mock_cp, 'hana.create_conf_file': mock_create, 'hana.update_conf_file': mock_update, 'hana.install': mock_install, 'file.remove': mock_remove}): assert hanamod.installed( 'prd', '00', 'pass', '/software', - 'root', 'pass', - sapadm_password='pass', - system_user_password='sys_pass') == ret + 'root', 'pass', hdb_pwd_file='passwords.xml') == ret mock_create.assert_called_once_with( software_path='/software', conf_file=hanamod.TMP_CONFIG_FILE, root_user='root', root_password='pass') + mock_cp.assert_called_with( + path='passwords.xml', + dest=hanamod.TMP_HDB_PWD_FILE) mock_update.assert_called_once_with( conf_file='hana_created.conf', sid='PRD', number='00', - password='pass', root_user='root', root_password='pass', - sapadm_password='pass', system_user_password='sys_pass') + root_user='root') mock_install.assert_called_once_with( software_path='/software', conf_file='hana_updated.conf', root_user='root', - root_password='pass') + root_password='pass', + hdb_pwd_file=hanamod.TMP_HDB_PWD_FILE) mock_remove.assert_has_calls([ - mock.call(hanamod.TMP_CONFIG_FILE), mock.call('{}.xml'.format(hanamod.TMP_CONFIG_FILE)) ])
