Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package salt-shaptools for openSUSE:Factory checked in at 2021-06-04 00:34:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/salt-shaptools (Old) and /work/SRC/openSUSE:Factory/.salt-shaptools.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "salt-shaptools" Fri Jun 4 00:34:04 2021 rev:24 rq:897229 version:0.3.11+git.1622732434.835d199 Changes: -------- --- /work/SRC/openSUSE:Factory/salt-shaptools/salt-shaptools.changes 2021-01-19 16:02:45.291430797 +0100 +++ /work/SRC/openSUSE:Factory/.salt-shaptools.new.1898/salt-shaptools.changes 2021-06-04 00:34:23.381014042 +0200 @@ -1,0 +2,5 @@ +Thu Mar 11 17:05:02 UTC 2021 - C??dric Bosdonnat <cbosdon...@suse.com> + +- add cluster init support for OCFS2 device + +------------------------------------------------------------------- Old: ---- salt-shaptools-0.3.11+git.1610983060.0bf6fcc.tar.gz New: ---- salt-shaptools-0.3.11+git.1622732434.835d199.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ salt-shaptools.spec ++++++ --- /var/tmp/diff_new_pack.hdy80T/_old 2021-06-04 00:34:24.037015931 +0200 +++ /var/tmp/diff_new_pack.hdy80T/_new 2021-06-04 00:34:24.041015942 +0200 @@ -19,7 +19,7 @@ # See also https://en.opensuse.org/openSUSE:Specfile_guidelines Name: salt-shaptools -Version: 0.3.11+git.1610983060.0bf6fcc +Version: 0.3.11+git.1622732434.835d199 Release: 0 Summary: Salt modules and states for SAP Applications and SLE-HA components management ++++++ _service ++++++ --- /var/tmp/diff_new_pack.hdy80T/_old 2021-06-04 00:34:24.069016023 +0200 +++ /var/tmp/diff_new_pack.hdy80T/_new 2021-06-04 00:34:24.069016023 +0200 @@ -5,7 +5,7 @@ <param name="exclude">.git</param> <param name="filename">salt-shaptools</param> <param name="versionformat">0.3.11+git.%ct.%h</param> - <param name="revision">0bf6fccd3119d0ba86d540f218d375140404b350</param> + <param name="revision">835d199a6117b0b5657f14ae8fc296af7709f382</param> </service> <service name="recompress" mode="disabled"> ++++++ salt-shaptools-0.3.11+git.1610983060.0bf6fcc.tar.gz -> salt-shaptools-0.3.11+git.1622732434.835d199.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/.coveragerc new/salt-shaptools-0.3.11+git.1622732434.835d199/.coveragerc --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/.coveragerc 2021-01-18 16:17:40.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/.coveragerc 2021-06-03 17:00:34.000000000 +0200 @@ -3,4 +3,4 @@ */tests/* */test/* *setup.py* - tests/* + tests/* \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/.github/workflows/salt-shaptools-ci.yml new/salt-shaptools-0.3.11+git.1622732434.835d199/.github/workflows/salt-shaptools-ci.yml --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/.github/workflows/salt-shaptools-ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/.github/workflows/salt-shaptools-ci.yml 2021-06-03 17:00:34.000000000 +0200 @@ -0,0 +1,105 @@ +name: Package CI +# - this workflow will +# - pytest with python version [2.7, 3.6, 3.7] +# - uploads coverage data to codeClimate and the results are linked as a badges in the README +# - deliver the package content to the configured repository +# - submit the new package content to the upstream repository +on: [push, pull_request] +env: + PACKAGE_NAME: salt-shaptools +jobs: + + test: + runs-on: ubuntu-18.04 + strategy: + matrix: + os: [ubuntu-18.04] + python-version: [2.7, 3.6, 3.7] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + pip install pyzmq PyYAML pycrypto msgpack-python jinja2 psutil futures tornado pytest-salt mock pytest-cov enum34 + git clone --depth=50 https://github.com/openSUSE/salt ../salt + rm ../salt/tests/conftest.py + git clone --depth=50 https://github.com/SUSE/shaptools.git ../shaptools + pip install -e ../salt + pip install ../shaptools + - name: execute test script + run: ./tests/run.sh + - name: change absolute path to relative path for successful upload to code climate + run: | + WORKSPACE=`dirname ${{ github.workspace }}`/salt/ + sed -i "s#$WORKSPACE##g" coverage.xml + - name: Publish code coverage + uses: paambaati/codeclimate-action@v2.7.5 + if: ${{ env.CC_TEST_REPORTER_ID != null && github.event_name != 'pull_request' }} + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + with: + coverageLocations: coverage.xml:coverage.py + + + delivery: + needs: [test] + runs-on: ubuntu-18.04 + if: ${{ github.event_name != 'pull_request' }} + container: + image: shap/continuous_deliver + env: + OBS_USER: ${{ secrets.OBS_USER }} + OBS_PASS: ${{ secrets.OBS_PASS }} + OBS_PROJECT: ${{ secrets.OBS_PROJECT }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: configure OSC + # OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home + # that is used to run osc commands + run: | + /scripts/init_osc_creds.sh + mkdir -p $HOME/.config/osc + cp /root/.config/osc/oscrc $HOME/.config/osc + - name: deliver package + run: | + sed -i 's~%%VERSION%%~${{ github.sha }}~' _service && \ + sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' _service && \ + /scripts/upload.sh + + + submit: + needs: [test, delivery] + runs-on: ubuntu-18.04 + if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} + container: + image: shap/continuous_deliver + env: + OBS_USER: ${{ secrets.OBS_USER }} + OBS_PASS: ${{ secrets.OBS_PASS }} + OBS_PROJECT: ${{ secrets.OBS_PROJECT}} + TARGET_PROJECT: ${{ secrets.TARGET_PROJECT}} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: configure OSC + # OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home + # that is used to run osc commands + run: | + /scripts/init_osc_creds.sh + mkdir -p $HOME/.config/osc + cp /root/.config/osc/oscrc $HOME/.config/osc + - name: submit package + run: | + sed -i 's~%%VERSION%%~${{ github.sha }}~' _service && \ + sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' _service && \ + /scripts/submit.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/.travis.yml new/salt-shaptools-0.3.11+git.1622732434.835d199/.travis.yml --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/.travis.yml 2021-01-18 16:17:40.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,78 +0,0 @@ -sudo: required -services: - - docker - -language: python - -stages: - - test - - delivery - - submit - -jobs: - include: - - stage: test - python: 2.7 - install: - - pip install --upgrade pip - - pip install --upgrade pytest - - pip install pyzmq PyYAML pycrypto msgpack-python jinja2 psutil futures tornado pytest-salt mock pytest-cov enum34 - - git clone --depth=50 https://github.com/openSUSE/salt ../salt - - rm ../salt/tests/conftest.py - - git clone --depth=50 https://github.com/SUSE/shaptools.git ../shaptools - - pip install -e ../salt - - pip install ../shaptools - script: - - ./tests/run.sh - - - stage: test - python: 3.6 - install: - - pip install --upgrade pip - - pip install --upgrade pytest - - pip install pyzmq PyYAML pycrypto msgpack-python jinja2 psutil futures tornado pytest-salt mock pytest-cov enum34 - - git clone --depth=50 https://github.com/openSUSE/salt ../salt - - rm ../salt/tests/conftest.py - - git clone --depth=50 https://github.com/SUSE/shaptools.git ../shaptools - - pip install -e ../salt - - pip install ../shaptools - before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - script: - - ./tests/run.sh - after_script: - - ./cc-test-reporter after-build -t coverage.py --exit-code $TRAVIS_TEST_RESULT -p $(readlink -f ../salt) - - - stage: delivery - if: type != pull_request - env: - - FOLDER=/package - - PACKAGE_NAME=salt-shaptools - - before_install: - - docker pull shap/continuous_deliver:latest - - script: - - | - docker run -t -v "$(pwd):/package" -w /package \ - -e OBS_USER -e OBS_PASS -e FOLDER -e OBS_PROJECT -e PACKAGE_NAME \ - shap/continuous_deliver \ - /bin/bash -c "sed -i 's~%%VERSION%%~$TRAVIS_COMMIT~' _service && \ - sed -i 's~%%REPOSITORY%%~$TRAVIS_REPO_SLUG~' _service && \ - /scripts/upload.sh" - - - stage: submit - if: type != pull_request AND branch = master - env: - - PACKAGE_NAME=salt-shaptools - - before_install: - - docker pull shap/continuous_deliver:latest - - script: - - | - docker run -t -v "$(pwd):/package" -w /package \ - -e OBS_USER -e OBS_PASS -e OBS_PROJECT -e PACKAGE_NAME -e TARGET_PROJECT shap/continuous_deliver \ - /scripts/submit.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/README.md new/salt-shaptools-0.3.11+git.1622732434.835d199/README.md --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/README.md 2021-01-18 16:17:40.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/README.md 2021-06-03 17:00:34.000000000 +0200 @@ -1,4 +1,4 @@ -[](https://travis-ci.org/SUSE/salt-shaptools) +[](https://github.com/SUSE/salt-shaptools/actions/workflows/salt-shaptools-ci.yml) [](https://codeclimate.com/github/SUSE/salt-shaptools/test_coverage) [](https://codeclimate.com/github/SUSE/salt-shaptools/maintainability) @@ -9,47 +9,57 @@ main idea is to use this module in salt formulas to deploy these applications easily. ## Installation and usage + **INFO:** Currently this project has been created as an independent project, but the idea is to merge to the [salt](https://github.com/saltstack/salt) project to extend it with these new functionalities. ### Run locally + To run the module functionalities locally run: + ```bash cd salt-shaptools sudo salt-call --local -m modules hana.is_installed ``` To run the state modules (there is a demo example in the demo folder) run: + ```bash cd salt-shaptools sudo salt-call --retcode-passthrough -l debug -m . state.template demo/primary.sls ``` ### Run in minions + To run the module funcionalities in the minions: -1. Copy the content of **modules** in your "salt://_modules/" (by default /srv/salt/_modules) -2. Copy the content of **states** in your "salt://_states/" (by default /srv/salt/_states) +1. Copy the content of **modules** in your "salt://\_modules/" (by default /srv/salt/\_modules) +2. Copy the content of **states** in your "salt://\_states/" (by default /srv/salt/\_states) 3. Synchronize modules with the minions. For that run: + ```bash sudo salt-call saltutil.sync_all ``` + 4. Execute the module functionalities. For that run: + ```bash sudo salt-call hana.is_installed ``` + ## Writing unit test You can have look at: https://docs.saltstack.com/en/latest/topics/development/tests/unit.html ## How to run the tests + Salt has a quite particular way to execute the tests. As a summary, tests are splitted -in *integration* and *unit* tests. The first group tests the module using actual -salt master/minions, so the setup is more complicated. The *unit* tests in the other +in _integration_ and _unit_ tests. The first group tests the module using actual +salt master/minions, so the setup is more complicated. The _unit_ tests in the other hand only check the code functions. -In order to execute the tests, the test files must be stored in the *salt* project +In order to execute the tests, the test files must be stored in the _salt_ project tests folder sub-folder (integration or unit, for example). By now, as the project is in a separated repository, the easiest way is to copy our project code to a actual salt repository and run the tests. For that follow the next instructions: @@ -57,19 +67,20 @@ 1. Download 2 **needed extra projects**: (saltstack and shaptools) ```bash -git clone --depth=50 https://github.com/openSUSE/salt +git clone --depth=50 https://github.com/openSUSE/salt git clone https://github.com/SUSE/shaptools.git ``` Your directory layout should looks like ( all the 3 dirs are in same three dir level) + ``` - salt-shaptools - salt - shaptools ``` +2. Create a virtual environment, inside the `salt-shaptools` dir and install dependencies: -2. Create a virtual environment, inside the `salt-shaptools` dir and install dependencies: ```bash virtualenv saltvirtenv source saltvirtenv/bin/activate @@ -80,13 +91,14 @@ ``` 3. Run the tests. For that: + ```bash cd salt-shaptools sudo chmod 755 tests/run.sh ./tests/run.sh ``` -4) Running your modules/states: +4. Running your modules/states: For testing/running modules: @@ -96,11 +108,11 @@ ``` For testing/running states: + ``` salt-call --local state.single saptune.solution_applied "HANA" ``` - ## Dependencies List of dependencies are specified in the ["Requirements file"](requirements.txt). Items can be installed using pip: @@ -117,5 +129,6 @@ ## Reviewers -*Pull request* preferred reviewers for this project: +_Pull request_ preferred reviewers for this project: + - Xabier Arbulu Insausti (xarb...@suse.com) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/salt/modules/crmshmod.py new/salt-shaptools-0.3.11+git.1622732434.835d199/salt/modules/crmshmod.py --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/salt/modules/crmshmod.py 2021-01-18 16:17:40.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/salt/modules/crmshmod.py 2021-06-03 17:00:34.000000000 +0200 @@ -281,6 +281,17 @@ __salt__['cmd.run'](cmd, raise_err=True) +def _crm_init_capabilities(): + ''' + Return a dictionary of features supported by crmsh + ''' + cmd = '{crm_command} cluster init --help'.format(crm_command=CRM_COMMAND) + init_help = __salt__['cmd.run'](cmd) + return { + 'ocfs2-mount': '--mount-point' in init_help, + } + + def _crm_init( name, watchdog=None, @@ -291,10 +302,13 @@ sbd_dev=None, no_overwrite_sshkey=False, qnetd_hostname=None, - quiet=None): + quiet=None, + ocfs2_dev=None, + ocfs2_mount=None): ''' crm cluster init command execution ''' + crm_caps = _crm_init_capabilities() cmd = '{crm_command} cluster init -y -n {name}'.format( crm_command=CRM_COMMAND, name=name) if watchdog: @@ -315,10 +329,21 @@ if qnetd_hostname: cmd = '{cmd} --qnetd-hostname {qnetd_hostname}'.format( cmd=cmd, qnetd_hostname=qnetd_hostname) + if ocfs2_dev and crm_caps['ocfs2-mount']: + ocfs2_str = ' '.join(['-o {}'.format(ocfs2) for ocfs2 in ocfs2_dev]) + cmd = '{cmd} {ocfs2_str}'.format(cmd=cmd, ocfs2_str=ocfs2_str) + if len(ocfs2_dev) > 1: + cmd = '{cmd} -C'.format(cmd=cmd) + if ocfs2_mount: + cmd = '{cmd} -m {ocfs2_mount}'.format(cmd=cmd, ocfs2_mount=ocfs2_mount) if quiet: cmd = '{cmd} -q'.format(cmd=cmd) - return __salt__['cmd.retcode'](cmd) + return_code = __salt__['cmd.retcode'](cmd) + if ocfs2_dev and not crm_caps['ocfs2-mount'] and return_code == 0: + return __salt__['cmd.retcode']('{crm_command} cluster init vgfs -y -n {name} -o {ocfs2_dev}'.format( + crm_command=CRM_COMMAND, name=name, ocfs2_dev=ocfs2_dev[0])) + return return_code def _ha_cluster_init( @@ -371,7 +396,9 @@ sbd_dev=None, no_overwrite_sshkey=False, qnetd_hostname=None, - quiet=None): + quiet=None, + ocfs2_dev=None, + ocfs2_mount=None): ''' Initialize a cluster from scratch. @@ -400,6 +427,11 @@ The name of the qnetd node. If none, no qdevice is created quiet: execute the command in quiet mode (no output) + ocfs2_dev + ocfs2 device path + This parameter can be a string (meaning one disk) or a list with multiple disks for OCFS2 LVM + ocfs2_mount + The OCFS2 mount point CLI Example: @@ -410,12 +442,15 @@ if sbd_dev and not isinstance(sbd_dev, list): sbd_dev = [sbd_dev] + if ocfs2_dev and not isinstance(ocfs2_dev, list): + ocfs2_dev = [ocfs2_dev] + # INFO: 2 different methods are created to make easy to read/understand # and create the corresponing UT if __salt__['crm.use_crm']: return _crm_init( name, watchdog, interface, unicast, admin_ip, sbd, sbd_dev, no_overwrite_sshkey, - qnetd_hostname, quiet) + qnetd_hostname, quiet, ocfs2_dev, ocfs2_mount) LOGGER.warning('The parameter name is not considered!') LOGGER.warning('--no_overwrite_sshkey option not available') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/salt/states/crmshmod.py new/salt-shaptools-0.3.11+git.1622732434.835d199/salt/states/crmshmod.py --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/salt/states/crmshmod.py 2021-01-18 16:17:40.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/salt/states/crmshmod.py 2021-06-03 17:00:34.000000000 +0200 @@ -107,7 +107,9 @@ sbd_dev=None, no_overwrite_sshkey=False, quiet=None, - qnetd_hostname=None): + qnetd_hostname=None, + ocfs2_dev=None, + ocfs2_mount=None): """ Machine is running a cluster node @@ -134,6 +136,11 @@ execute the command in quiet mode (no output) qnetd_hostname: The name of the qnetd node. If none, no qdevice is created + ocfs2_dev + ocfs2 device path + This parameter can be a string (meaning one disk) or a list with multiple disks + ocfs2_path + the OCFS2 mount path. Defaults to /srv/clusterfs """ ret = {'name': name, 'changes': {}, @@ -163,7 +170,9 @@ sbd_dev=sbd_dev, no_overwrite_sshkey=no_overwrite_sshkey, qnetd_hostname=qnetd_hostname, - quiet=quiet) + quiet=quiet, + ocfs2_dev=ocfs2_dev, + ocfs2_mount=ocfs2_mount) if result: ret['changes']['name'] = name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/salt-shaptools.changes new/salt-shaptools-0.3.11+git.1622732434.835d199/salt-shaptools.changes --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/salt-shaptools.changes 2021-01-18 16:17:40.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/salt-shaptools.changes 2021-06-03 17:00:34.000000000 +0200 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Mar 11 17:05:02 UTC 2021 - C??dric Bosdonnat <cbosdon...@suse.com> + +- add cluster init support for OCFS2 device + +------------------------------------------------------------------- Wed Dec 16 09:04:29 UTC 2020 - Aleksei Burlakov <aburla...@suse.com> - qdevice support: it can be created when initializing a cluster diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/tests/unit/modules/test_crmshmod.py new/salt-shaptools-0.3.11+git.1622732434.835d199/tests/unit/modules/test_crmshmod.py --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/tests/unit/modules/test_crmshmod.py 2021-01-18 16:17:40.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/tests/unit/modules/test_crmshmod.py 2021-06-03 17:00:34.000000000 +0200 @@ -332,12 +332,13 @@ ''' Test _crm_init method ''' - mock_cmd_run = MagicMock(return_value=True) + mock_cmd_retcode = MagicMock(return_value=True) + mock_cmd_run = MagicMock(return_value="crm cluster init help without ocfs2 mount") - with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}): + with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_retcode, 'cmd.run': mock_cmd_run}): result = crmshmod._crm_init('hacluster') assert result - mock_cmd_run.assert_called_once_with( + mock_cmd_retcode.assert_called_once_with( '{crm_command} cluster init -y -n {name}'.format( crm_command=crmshmod.CRM_COMMAND, name='hacluster')) @@ -345,24 +346,49 @@ ''' Test _crm_init method ''' - mock_cmd_run = MagicMock(return_value=True) + mock_cmd_retcode = MagicMock(return_value=0) + mock_cmd_run = MagicMock(return_value="crm cluster init help without ocfs2 mount") - with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}): + with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_retcode, 'cmd.run': mock_cmd_run}): result = crmshmod._crm_init( - 'hacluster', 'dog', 'eth1', True, '192.168.1.50', True, ['dev1', 'dev2'], True, 'alice', True) - assert result - mock_cmd_run.assert_called_once_with( + 'hacluster', 'dog', 'eth1', True, '192.168.1.50', True, ['dev1', 'dev2'], True, 'alice', True, ['disk3']) + assert result == 0 + mock_cmd_retcode.assert_any_call( '{} cluster init -y -n {} -w {} -i {} -u -A {} ' '-s {} -s {} --no-overwrite-sshkey --qnetd-hostname {} -q'.format( crmshmod.CRM_COMMAND, 'hacluster', 'dog', 'eth1', '192.168.1.50', 'dev1', 'dev2', 'alice')) + mock_cmd_retcode.assert_any_call( + '{} cluster init vgfs -y -n {} -o {}'.format(crmshmod.CRM_COMMAND, 'hacluster', 'disk3')) + + # New OCFS2 parameters + mock_cmd_run = MagicMock(return_value="crm cluster init help with --mount-point") + mock_cmd_retcode.reset_mock() + with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_retcode, 'cmd.run': mock_cmd_run}): + result = crmshmod._crm_init( + 'hacluster', 'dog', 'eth1', True, '192.168.1.50', True, ['dev1', 'dev2'], True, 'alice', True, ['disk3'], 'ocfs2_mount') + assert result == 0 + mock_cmd_retcode.assert_any_call( + '{} cluster init -y -n {} -w {} -i {} -u -A {} ' + '-s {} -s {} --no-overwrite-sshkey --qnetd-hostname {} -o {} -m {} -q'.format( + crmshmod.CRM_COMMAND, 'hacluster', 'dog', 'eth1', '192.168.1.50', 'dev1', 'dev2', 'alice', 'disk3', 'ocfs2_mount')) + + # OCFS2+LVM parameters + mock_cmd_retcode.reset_mock() + result = crmshmod._crm_init( + 'hacluster', 'dog', 'eth1', True, '192.168.1.50', True, ['dev1', 'dev2'], True, 'alice', True, ['disk3', 'disk4'], 'ocfs2_mount') + assert result == 0 + mock_cmd_retcode.assert_any_call( + '{} cluster init -y -n {} -w {} -i {} -u -A {} ' + '-s {} -s {} --no-overwrite-sshkey --qnetd-hostname {} -o {} -o {} -C -m {} -q'.format( + crmshmod.CRM_COMMAND, 'hacluster', 'dog', 'eth1', '192.168.1.50', 'dev1', 'dev2', 'alice', 'disk3', 'disk4', 'ocfs2_mount')) # SBD diskless - mock_cmd_run.reset_mock() - with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}): + mock_cmd_retcode.reset_mock() + with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_retcode, 'cmd.run': mock_cmd_run}): result = crmshmod._crm_init( 'hacluster', 'dog', 'eth1', True, '192.168.1.50', True, None, True, 'alice', True) - assert result - mock_cmd_run.assert_called_once_with( + assert result == 0 + mock_cmd_retcode.assert_called_once_with( '{} cluster init -y -n {} -w {} -i {} -u -A {} ' '-S --no-overwrite-sshkey --qnetd-hostname {} -q'.format( crmshmod.CRM_COMMAND, 'hacluster', 'dog', 'eth1', '192.168.1.50', 'alice')) @@ -427,15 +453,15 @@ value = crmshmod.cluster_init('hacluster', 'dog', 'eth1', sbd=True, sbd_dev='dev1') assert value == 0 crm_init.assert_called_once_with( - 'hacluster', 'dog', 'eth1', None, None, True, ['dev1'], False, None, None) + 'hacluster', 'dog', 'eth1', None, None, True, ['dev1'], False, None, None, None, None) crm_init.reset_mock() with patch.dict(crmshmod.__salt__, {'crm.use_crm': True}): crm_init.return_value = 0 - value = crmshmod.cluster_init('hacluster', 'dog', 'eth1', sbd=False, sbd_dev=['disk1', 'disk2']) + value = crmshmod.cluster_init('hacluster', 'dog', 'eth1', sbd=False, sbd_dev=['disk1', 'disk2'], ocfs2_dev='disk3', ocfs2_mount='mount') assert value == 0 crm_init.assert_called_once_with( - 'hacluster', 'dog', 'eth1', None, None, False, ['disk1', 'disk2'], False, None, None) + 'hacluster', 'dog', 'eth1', None, None, False, ['disk1', 'disk2'], False, None, None, ['disk3'], 'mount') @mock.patch('logging.Logger.warning') @mock.patch('salt.modules.crmshmod._ha_cluster_init') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/tests/unit/states/test_crmshmod.py new/salt-shaptools-0.3.11+git.1622732434.835d199/tests/unit/states/test_crmshmod.py --- old/salt-shaptools-0.3.11+git.1610983060.0bf6fcc/tests/unit/states/test_crmshmod.py 2021-01-18 16:17:40.000000000 +0100 +++ new/salt-shaptools-0.3.11+git.1622732434.835d199/tests/unit/states/test_crmshmod.py 2021-06-03 17:00:34.000000000 +0200 @@ -177,6 +177,8 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + ocfs2_dev='/dev/ocfs2', + ocfs2_mount='/srv/ocfs2', no_overwrite_sshkey=True, quiet=False) == ret mock_status.assert_called_once_with() @@ -188,6 +190,8 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + ocfs2_dev='/dev/ocfs2', + ocfs2_mount='/srv/ocfs2', no_overwrite_sshkey=True, qnetd_hostname=None, quiet=False) @@ -214,6 +218,8 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + ocfs2_dev='/dev/ocfs2', + ocfs2_mount='/srv/ocfs2', no_overwrite_sshkey=True, quiet=False) == ret mock_status.assert_called_once_with() @@ -225,6 +231,8 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + ocfs2_dev='/dev/ocfs2', + ocfs2_mount='/srv/ocfs2', no_overwrite_sshkey=True, qnetd_hostname=None, quiet=False) @@ -252,6 +260,8 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + ocfs2_dev='/dev/ocfs2', + ocfs2_mount='/srv/ocfs2', no_overwrite_sshkey=False, quiet=False) == ret mock_status.assert_called_once_with() @@ -263,6 +273,8 @@ admin_ip='192.168.1.50', sbd=True, sbd_dev='/dev/sbd', + ocfs2_dev='/dev/ocfs2', + ocfs2_mount='/srv/ocfs2', no_overwrite_sshkey=False, qnetd_hostname=None, quiet=False)