Giter VIP home page Giter VIP logo

mongodb-formula's Introduction

mongodb-formula

Formula for MongoDB on GNU/Linux and MacOS.

Travis CI Build Status Semantic Release

See the full SaltStack Formulas installation and usage instructions. If you are interested in writing or contributing to formulas, please pay attention to the Writing Formula Section. If you want to use this formula, please pay attention to the FORMULA file and/or git tag, which contains the currently released version. This formula is versioned according to Semantic Versioning. See Formula Versioning Section for more details.

By default only MongoDB server component (mongod) is installed. This behaviour is configurable via pillars.

mongodb:
  wanted:
    # choose what you want or everything
    database:
      - mongod
      - mongos
      - dbtools
      - shell
    gui:
      - robo3t
      - compass
    connectors:
      - bi
      - kafka

Configuration can be supplied in yaml:

mongodb:
  pkg:
    database:
      version: 4.2.6.1
      archive:
        skip_verify: true
      config:
        # http://docs.mongodb.org/manual/reference/configuration-options
        storage:
          dbPath: /var/lib/mongodb/mongod
        replication:
          replSetName: "rs1"
        sharding:
          clusterRole: shardsvr
        net:
          bindIp: '0.0.0.0,::'
          port: 27018
      firewall:
        ports:
          - tcp/27017
          - tcp/27018
          - tcp/27019

Commit message formatting is significant!!

Please see How to contribute for more details.

Meta-state (This is a state that includes other states).

This installs the MongoDB solution.

This state will install mongodb components on MacOS and GNU/Linux from archive.

This state will apply mongodb service configuration (files).

This state will start mongodb component services.

This state will stop mongodb component services.

This state will remove mongodb service configuration (files).

This state will remove mongodb components on MacOS and GNU/Linux.

Linux testing is done with kitchen-salt.

Requirements

  • Ruby
  • Docker
$ gem install bundler
$ bundle install
$ bin/kitchen test [platform]

Where [platform] is the platform name defined in kitchen.yml, e.g. debian-9-2019-2-py3.

bin/kitchen converge

Creates the docker instance and runs the mongodb main state, ready for testing.

bin/kitchen verify

Runs the inspec tests on the actual instance.

bin/kitchen destroy

Removes the docker instance.

bin/kitchen test

Runs all of the stages above in one go: i.e. destroy + converge + verify + destroy.

bin/kitchen login

Gives you SSH access to the instance for manual testing.

mongodb-formula's People

Contributors

abednarik avatar aboe76 avatar auser avatar baby-gnu avatar blarghmatey avatar dafyddj avatar eglute avatar genuss avatar gravyboat avatar heinrichfilter avatar holms avatar iggy avatar kevinschoon avatar littleski avatar maratsh avatar myii avatar nmadhok avatar noelmcloughlin avatar puneetk avatar sbreidba avatar semantic-release-bot avatar stp-ip avatar techhat avatar thatch45 avatar utahdave avatar viktortnk avatar vutny avatar wdalmut avatar whiteinge avatar wwentland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongodb-formula's Issues

Many Salt warnings on MacOS

Some of these need to be checked

[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/loader.py:772: DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5
  ret = funcs[key]()

[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/path.py:265: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  if not isinstance(exes, collections.Iterable):

[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/payload.py:149: DeprecationWarning: encoding is deprecated, Use raw=False instead.
  ret = msgpack.loads(msg, use_list=True, ext_hook=ext_type_decoder, encoding=encoding)

[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  *salt.utils.args.get_function_argspec(original_function)

[WARNING ] Unable to parse "/Library/LaunchAgents/org.mongo.mongodb.mongod.plist" as it is invalid XML: InvalidFileException.
[WARNING ] Unable to parse "/Library/LaunchAgents/org.mongo.mongodb.mongos.plist" as it is invalid XML: InvalidFileException.
[WARNING ] Unable to parse "/Library/LaunchDaemons/net.pulsesecure.UninstallPulse.plist" as it is invalid XML: xml.parsers.expat.ExpatError.
[WARNING ] Unable to parse "/Users/username/Library/LaunchAgents/net.pulsesecure.SetupClient.plist" as it is invalid XML: xml.parsers.expat.ExpatError.
[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  *salt.utils.args.get_function_argspec(original_function)

[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  *salt.utils.args.get_function_argspec(original_function)

[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  *salt.utils.args.get_function_argspec(original_function)

[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/oset.py:47: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  class OrderedSet(collections.MutableSet):

[ERROR   ] Command '['dscl', 'localhost', '-delete', '/Local/Default/Groups/com.apple.sharepoint.group.2', 'GroupMembership', 'mongodb']' failed with return code: 54
[ERROR   ] stderr: <main> attribute status: eDSAttributeNotFound
<dscl_cmd> DS Error: -14134 (eDSAttributeNotFound)
[ERROR   ] retcode: 54
[ERROR   ] Command '['dscl', 'localhost', '-delete', '/Local/Default/Groups/_lpoperator', 'GroupMembership', 'mongodb']' failed with return code: 54
[ERROR   ] stderr: <main> attribute status: eDSAttributeNotFound
<dscl_cmd> DS Error: -14134 (eDSAttributeNotFound)
[ERROR   ] retcode: 54
[ERROR   ] Command '['dscl', 'localhost', '-delete', '/Local/Default/Groups/everyone', 'GroupMembership', 'mongodb']' failed with return code: 54
[ERROR   ] stderr: <main> attribute status: eDSAttributeNotFound
<dscl_cmd> DS Error: -14134 (eDSAttributeNotFound)
[ERROR   ] retcode: 54
[ERROR   ] Command '['dscl', 'localhost', '-delete', '/Local/Default/Groups/localaccounts', 'GroupMembership', 'mongodb']' failed with return code: 54
[ERROR   ] stderr: <main> attribute status: eDSAttributeNotFound
<dscl_cmd> DS Error: -14134 (eDSAttributeNotFound)
[ERROR   ] retcode: 54
[ERROR   ] Command '['dscl', 'localhost', '-delete', '/Local/Default/Groups/com.apple.sharepoint.group.1', 'GroupMembership', 'mongodb']' failed with return code: 54
[ERROR   ] stderr: <main> attribute status: eDSAttributeNotFound
<dscl_cmd> DS Error: -14134 (eDSAttributeNotFound)
[ERROR   ] retcode: 54
[ERROR   ] These values could not be changed: {'groups': ['mongodb']}
[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  *salt.utils.args.get_function_argspec(original_function)

[WARNING ] Unable to parse "/Library/LaunchAgents/org.mongo.mongodb.mongod.plist" as it is invalid XML: InvalidFileException.
[WARNING ] Unable to parse "/Library/LaunchAgents/org.mongo.mongodb.mongos.plist" as it is invalid XML: InvalidFileException.
[WARNING ] Unable to parse "/Library/LaunchDaemons/net.pulsesecure.UninstallPulse.plist" as it is invalid XML: xml.parsers.expat.ExpatError.
[WARNING ] Unable to parse "/Users/username/Library/LaunchAgents/net.pulsesecure.SetupClient.plist" as it is invalid XML: xml.parsers.expat.ExpatError.
[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  *salt.utils.args.get_function_argspec(original_function)

[WARNING ] /usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  *salt.utils.args.get_function_argspec(original_function)

Versions

/usr/local/Cellar/salt/2019.2.0/libexec/lib/python3.7/site-packages/salt/version.py:632: DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5
  lin_ver = linux_distribution()
Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: 1.11.5
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: 0.27.8
        libnacl: Not Installed
       M2Crypto: 0.31.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.1
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.27.3
         Python: 3.7.2 (default, Feb 12 2019, 08:16:38)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 18.0.1
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.1
 
System Versions:
           dist:   
         locale: UTF-8
        machine: x86_64
        release: 17.7.0
         system: Darwin
        version: 10.13.6 x86_64

Service name is wrong on Debian

As discussed in #8 this formula uses mongod as service name for Debian (and other distributions of the same os_family) while it should be mongodb. This causes the following error during the installation on wheezy:

----------
          ID: mongodb_service
    Function: service.running
        Name: mongod
      Result: False
     Comment: Failed to start the service
     Changes:   
              ----------
              mongod:
                  False

Rather than extended support for the PPA it would be nice if this formula could support the standard packages in Debian and, if support for newer versions is needed, also wheezy-backports.

mongos not using mdb.version

While in init.sls the repo is defined as
- name: deb http://repo.mongodb.org/apt/{{ os }} {{ code }}/mongodb-org/{{ mdb.version }} {{ mdb.repo_component }}
in mongos.sls it's
- name: deb http://repo.mongodb.org/apt/{{ os }} {{ code }}/mongodb-org/stable multiverse
And it seems repo.mongodb.org is not using "stable" (anymore):
http://repo.mongodb.org/apt/debian/dists/jessie/mongodb-org/
3.2
3.3
development
testing

[BUG] State failures on CentOS8

Your setup

Formula commit hash / release tag

Versions reports (master & minion)

Pillar / config used


Bug details

Describe the bug

[ERROR   ] Command '['systemd-run', '--scope', 'yum', '-y', '--disablerepo=*', '--enablerepo=mongodb-org-4.0', 'install', 'mongodb-org']' failed with return code: 1
[ERROR   ] stdout: Running scope as unit: run-r07e0b6afaa14482595e7e36c97202fe1.scope
Error: 
 Problem: package mongodb-org-4.0.18-1.el8.x86_64 requires mongodb-org-server = 4.0.18, but none of the providers can be installed
  - cannot install the best candidate for the job
  - nothing provides python2 needed by mongodb-org-server-4.0.18-1.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
[ERROR   ] retcode: 1
[ERROR   ] Error occurred installing package(s). Additional info follows:

errors:
    - Running scope as unit: run-r07e0b6afaa14482595e7e36c97202fe1.scope
      Error: 
       Problem: package mongodb-org-4.0.18-1.el8.x86_64 requires mongodb-org-server = 4.0.18, but none of the providers can be installed
        - cannot install the best candidate for the job
        - nothing provides python2 needed by mongodb-org-server-4.0.18-1.el8.x86_64
      (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
[ERROR   ] Command '['systemd-run', '--scope', 'yum', '-y', 'install', 'policycoreutils-python']' failed with return code: 1
[ERROR   ] stdout: Running scope as unit: run-rc39844862aab438a92700ad13bd72ea4.scope
SaltStack repo for RHEL/CentOS 8                2.0 kB/s | 557  B     00:00    
Failed to download metadata for repo 'saltstack'
Ignoring repositories: saltstack
Last metadata expiration check: 0:00:01 ago on Sun May 10 22:34:37 2020.
No match for argument: policycoreutils-python
Error: Unable to find a match: policycoreutils-python
[ERROR   ] retcode: 1
[ERROR   ] Error occurred installing package(s). Additional info follows:

errors:
    - Running scope as unit: run-rc39844862aab438a92700ad13bd72ea4.scope
      SaltStack repo for RHEL/CentOS 8                2.0 kB/s | 557  B     00:00    
      Failed to download metadata for repo 'saltstack'
      Ignoring repositories: saltstack
      Last metadata expiration check: 0:00:01 ago on Sun May 10 22:34:37 2020.
      No match for argument: policycoreutils-python
      Error: Unable to find a match: policycoreutils-python
[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] Command '['systemd-run', '--scope', 'systemctl', 'start', 'mongod.service']' failed with return code: 1
[ERROR   ] stderr: Running scope as unit: run-r44ab2491f0b04e63af7d098d218bbd03.scope
Job for mongod.service failed because the control process exited with error code.
See "systemctl status mongod.service" and "journalctl -xe" for details.
[ERROR   ] retcode: 1
[ERROR   ] Job for mongod.service failed because the control process exited with error code.
See "systemctl status mongod.service" and "journalctl -xe" for details.
[ERROR   ] Command '['systemd-run', '--scope', 'systemctl', 'start', 'mongod.service']' failed with return code: 1
[ERROR   ] stderr: Running scope as unit: run-r00b53ceca0744c02962249f6e805cb83.scope
Job for mongod.service failed because the control process exited with error code.
See "systemctl status mongod.service" and "journalctl -xe" for details.
[ERROR   ] retcode: 1
[ERROR   ] Job for mongod.service failed because the control process exited with error code.
See "systemctl status mongod.service" and "journalctl -xe" for details.
[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
Reason: 'selinux' __virtual__ returned False

[ERROR   ] {'mongos': True}
local:
----------
          ID: mongodb server package repo
    Function: pkgrepo.managed
        Name: mongodb-org-4.0
      Result: True
     Comment: Configured package repo 'mongodb-org-4.0'
     Started: 22:34:26.694044
    Duration: 3716.061 ms
     Changes:   
              ----------
              repo:
                  mongodb-org-4.0
----------
          ID: mongodb server package installed
    Function: pkg.installed
        Name: mongodb-org
      Result: False
     Comment: Error occurred installing package(s). Additional info follows:
              
              errors:
                  - Running scope as unit: run-r07e0b6afaa14482595e7e36c97202fe1.scope
                    Error: 
                     Problem: package mongodb-org-4.0.18-1.el8.x86_64 requires mongodb-org-server = 4.0.18, but none of the providers can be installed
                      - cannot install the best candidate for the job
                      - nothing provides python2 needed by mongodb-org-server-4.0.18-1.el8.x86_64
                    (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
     Started: 22:34:30.425588
    Duration: 3123.919 ms
     Changes:   
----------
          ID: mongodb server selinux packages
    Function: pkg.installed
        Name: policycoreutils-python
      Result: False
     Comment: Error occurred installing package(s). Additional info follows:
              
              errors:
                  - Running scope as unit: run-rc39844862aab438a92700ad13bd72ea4.scope
                    SaltStack repo for RHEL/CentOS 8                2.0 kB/s | 557  B     00:00    
                    Failed to download metadata for repo 'saltstack'
                    Ignoring repositories: saltstack
                    Last metadata expiration check: 0:00:01 ago on Sun May 10 22:34:37 2020.
                    No match for argument: policycoreutils-python
                    Error: Unable to find a match: policycoreutils-python
     Started: 22:34:33.549978
    Duration: 5775.722 ms
     Changes:   
----------
          ID: mongodb server selinux packages
    Function: pkg.installed
        Name: selinux-policy-targeted
      Result: True
     Comment: All specified packages are already installed
     Started: 22:34:39.325995
    Duration: 17.352 ms
     Changes:   
----------
          ID: mongodb server firewalld service
    Function: service.running
        Name: firewalld
      Result: True
     Comment: The service firewalld is already running
     Started: 22:34:39.343989
    Duration: 31.656 ms
     Changes:   
----------
          ID: mongodb server user and group present
    Function: group.present
        Name: mongod
      Result: True
     Comment: New group mongod created
     Started: 22:34:39.376587
    Duration: 293.429 ms
     Changes:   
              ----------
              gid:
                  1001
              members:
              name:
                  mongod
              passwd:
                  x
----------
          ID: mongodb server user and group present
    Function: user.present
        Name: mongod
      Result: True
     Comment: New user mongod created
     Started: 22:34:39.671715
    Duration: 529.036 ms
     Changes:   
              ----------
              fullname:
                  mongoDB user
              gid:
                  1001
              groups:
                  - mongod
              home:
              homephone:
              name:
                  mongod
              other:
              passwd:
                  x
              roomnumber:
              shell:
                  /bin/bash
              uid:
                  1001
              workphone:
----------
          ID: mongodb server tools pypip package
    Function: pkg.installed
        Name: python2-pip
      Result: True
     Comment: The following packages were installed/updated: python2-pip
     Started: 22:34:40.201085
    Duration: 33328.931 ms
     Changes:   
              ----------
              python2:
                  ----------
                  new:
                      2.7.16-12.module_el8.1.0+219+cf9e6ac9
                  old:
              python2-libs:
                  ----------
                  new:
                      2.7.16-12.module_el8.1.0+219+cf9e6ac9
                  old:
              python2-pip:
                  ----------
                  new:
                      9.0.3-14.module_el8.1.0+219+cf9e6ac9
                  old:
              python2-pip-wheel:
                  ----------
                  new:
                      9.0.3-14.module_el8.1.0+219+cf9e6ac9
                  old:
              python2-setuptools:
                  ----------
                  new:
                      39.0.1-11.module_el8.1.0+219+cf9e6ac9
                  old:
              python2-setuptools-wheel:
                  ----------
                  new:
                      39.0.1-11.module_el8.1.0+219+cf9e6ac9
                  old:
----------
          ID: mongodb server tools pymongo package
    Function: pip.installed
        Name: pymongo
      Result: True
     Comment: All packages were successfully installed
     Started: 22:35:20.622001
    Duration: 3799.319 ms
     Changes:   
              ----------
              pymongo==3.10.1:
                  Installed
----------
          ID: mongodb server mongod logpath
    Function: file.directory
        Name: /var/log/mongodb
      Result: True
     Comment: Directory /var/log/mongodb updated
     Started: 22:35:24.424140
    Duration: 5.041 ms
     Changes:   
              ----------
              /var/log/mongodb:
                  New Dir
----------
          ID: mongodb server mongod logpath
    Function: selinux.fcontext_policy_present
        Name: /var/log/mongodb(/.*)?
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongod datapath
    Function: file.directory
        Name: /var/lib/mongodb/mongod
      Result: True
     Comment: Directory /var/lib/mongodb/mongod updated
     Started: 22:35:31.854484
    Duration: 2.997 ms
     Changes:   
              ----------
              /var/lib/mongodb/mongod:
                  New Dir
----------
          ID: mongodb server mongod datapath
    Function: selinux.fcontext_policy_present
        Name: /var/lib/mongodb(/.*)?
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongod config
    Function: file.managed
        Name: /etc/mongod.conf
      Result: True
     Comment: File /etc/mongod.conf updated
     Started: 22:35:31.858515
    Duration: 43.031 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: mongodb server mongod config
    Function: selinux.fcontext_policy_present
        Name: /etc/mongod.conf(/.*)?
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongod logrotate add
    Function: file.managed
        Name: /etc/logrotate.d/mongodb_mongod
      Result: True
     Comment: File /etc/logrotate.d/mongodb_mongod updated
     Started: 22:35:31.902492
    Duration: 48.966 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0440
----------
          ID: mongodb server mongod logrotate add
    Function: selinux.fcontext_policy_present
        Name: /etc/logrotate.d/mongodb_mongod(/.*)?
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongod pidpath add
    Function: file.directory
        Name: /var/run/mongodb
      Result: True
     Comment: Directory /var/run/mongodb updated
     Started: 22:35:31.954090
    Duration: 4.237 ms
     Changes:   
              ----------
              /var/run/mongodb:
                  New Dir
----------
          ID: mongodb server mongod pidpath add
    Function: selinux.fcontext_policy_present
        Name: /var/run/mongodb
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongod transparent huge pages
    Function: file.managed
        Name: /etc/init.d/disable-transparent-hugepages
      Result: True
     Comment: File /etc/init.d/disable-transparent-hugepages updated
     Started: 22:35:31.959665
    Duration: 52.201 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0755
----------
          ID: mongodb server mongod transparent huge pages
    Function: cmd.run
        Name: echo never >/sys/kernel/mm/transparent_hugepage/enabled
      Result: True
     Comment: Command "echo never >/sys/kernel/mm/transparent_hugepage/enabled" run
     Started: 22:35:32.012503
    Duration: 12.974 ms
     Changes:   
              ----------
              pid:
                  12753
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: mongodb server mongod systemd service file
    Function: file.managed
        Name: /usr/lib/systemd/system/mongod.service
      Result: True
     Comment: File /usr/lib/systemd/system/mongod.service updated
     Started: 22:35:32.025904
    Duration: 44.103 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: mongodb server mongod systemd service file
    Function: firewalld.service
        Name: mongod
      Result: True
     Comment: 'mongod' was configured.
     Started: 22:35:32.071279
    Duration: 3256.807 ms
     Changes:   
              ----------
              ports:
                  ----------
                  new:
                      - 27018/tcp
                  old:
----------
          ID: mongodb server mongod service running
    Function: selinux.fcontext_policy_applied
        Name: /var/lib/mongodb/mongod
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongod datapath, mongodb.server.config.mongodb server mongod logpath, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongod logrotate add, mongodb.server.config.mongodb server mongod config, mongodb.server.config.mongodb server mongod pidpath add
     Started: 22:35:35.330679
    Duration: 0.004 ms
     Changes:   
----------
          ID: mongodb server mongod service running
    Function: selinux.fcontext_policy_applied
        Name: /var/log/mongodb
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongod datapath, mongodb.server.config.mongodb server mongod logpath, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongod logrotate add, mongodb.server.config.mongodb server mongod config, mongodb.server.config.mongodb server mongod pidpath add
     Started: 22:35:35.331725
    Duration: 0.004 ms
     Changes:   
----------
          ID: mongodb server mongod service running
    Function: selinux.fcontext_policy_applied
        Name: /var/run/mongodb
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongod datapath, mongodb.server.config.mongodb server mongod logpath, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongod logrotate add, mongodb.server.config.mongodb server mongod config, mongodb.server.config.mongodb server mongod pidpath add
     Started: 22:35:35.332810
    Duration: 0.003 ms
     Changes:   
----------
          ID: mongodb server mongod service running
    Function: selinux.fcontext_policy_applied
        Name: /etc/mongod.conf
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongod datapath, mongodb.server.config.mongodb server mongod logpath, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongod logrotate add, mongodb.server.config.mongodb server mongod config, mongodb.server.config.mongodb server mongod pidpath add
     Started: 22:35:35.333834
    Duration: 0.003 ms
     Changes:   
----------
          ID: mongodb server mongod service running
    Function: selinux.fcontext_policy_applied
        Name: /etc/logrotate.d/mongodb_mongod
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongod datapath, mongodb.server.config.mongodb server mongod logpath, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongod logrotate add, mongodb.server.config.mongodb server mongod config, mongodb.server.config.mongodb server mongod pidpath add
     Started: 22:35:35.334872
    Duration: 0.003 ms
     Changes:   
----------
          ID: mongodb server mongod service running
    Function: cmd.run
        Name: firewall-cmd --add-service mongod --permanent
      Result: True
     Comment: Command "firewall-cmd --add-service mongod --permanent" run
     Started: 22:35:35.335116
    Duration: 274.212 ms
     Changes:   
              ----------
              pid:
                  12988
              retcode:
                  0
              stderr:
              stdout:
                  success
----------
          ID: mongodb server mongod service running
    Function: cmd.run
        Name: firewall-cmd --add-port=27018/tcp --permanent
      Result: True
     Comment: Command "firewall-cmd --add-port=27018/tcp --permanent" run
     Started: 22:35:35.610284
    Duration: 266.836 ms
     Changes:   
              ----------
              pid:
                  12989
              retcode:
                  0
              stderr:
              stdout:
                  success
----------
          ID: mongodb server mongod service running
    Function: cmd.run
        Name: firewall-cmd --reload
      Result: True
     Comment: Command "firewall-cmd --reload" run
     Started: 22:35:35.877751
    Duration: 1841.463 ms
     Changes:   
              ----------
              pid:
                  12990
              retcode:
                  0
              stderr:
              stdout:
                  success
----------
          ID: mongodb server mongod service running
    Function: service.running
        Name: mongod
      Result: False
     Comment: Job for mongod.service failed because the control process exited with error code.
              See "systemctl status mongod.service" and "journalctl -xe" for details.
     Started: 22:35:37.816257
    Duration: 101.165 ms
     Changes:   
----------
          ID: mongodb server shell etc mongorc add
    Function: file.managed
        Name: /etc/mongorc.js
      Result: True
     Comment: File /etc/mongorc.js updated
     Started: 22:35:37.918545
    Duration: 49.673 ms
     Changes:   
              ----------
              diff:
                  New file
              group:
                  mongod
              mode:
                  0644
              user:
                  mongod
----------
          ID: mongodb server mongos logpath
    Function: file.directory
        Name: /var/log/mongodb
      Result: True
     Comment: The directory /var/log/mongodb is in the correct state
     Started: 22:35:37.969302
    Duration: 2.561 ms
     Changes:   
----------
          ID: mongodb server mongos logpath
    Function: selinux.fcontext_policy_present
        Name: /var/log/mongodb(/.*)?
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongos config
    Function: file.managed
        Name: /etc/mongos.conf
      Result: True
     Comment: File /etc/mongos.conf updated
     Started: 22:35:37.973918
    Duration: 24.099 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: mongodb server mongos config
    Function: selinux.fcontext_policy_present
        Name: /etc/mongos.conf(/.*)?
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongos logrotate add
    Function: file.managed
        Name: /etc/logrotate.d/mongodb_mongos
      Result: True
     Comment: File /etc/logrotate.d/mongodb_mongos updated
     Started: 22:35:38.000128
    Duration: 50.923 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0440
----------
          ID: mongodb server mongos logrotate add
    Function: selinux.fcontext_policy_present
        Name: /etc/logrotate.d/mongodb_mongos(/.*)?
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongos pidpath add
    Function: file.directory
        Name: /var/run/mongodb
      Result: True
     Comment: The directory /var/run/mongodb is in the correct state
     Started: 22:35:38.052711
    Duration: 1.833 ms
     Changes:   
----------
          ID: mongodb server mongos pidpath add
    Function: selinux.fcontext_policy_present
        Name: /var/run/mongodb
      Result: False
     Comment: State 'selinux.fcontext_policy_present' was not found in SLS 'mongodb.server.config'
              Reason: 'selinux' __virtual__ returned False
     Changes:   
----------
          ID: mongodb server mongos transparent huge pages
    Function: file.managed
        Name: /etc/init.d/disable-transparent-hugepages
      Result: True
     Comment: onlyif execution failed, bad type passed
              unless condition is true
     Started: 22:35:38.055488
    Duration: 32.318 ms
     Changes:   
----------
          ID: mongodb server mongos transparent huge pages
    Function: cmd.run
        Name: echo never >/sys/kernel/mm/transparent_hugepage/enabled
      Result: True
     Comment: onlyif condition is false
     Started: 22:35:38.088224
    Duration: 1.275 ms
     Changes:   
----------
          ID: mongodb server mongos systemd service file
    Function: file.managed
        Name: /usr/lib/systemd/system/mongos.service
      Result: True
     Comment: File /usr/lib/systemd/system/mongos.service updated
     Started: 22:35:38.089788
    Duration: 42.895 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: mongodb server mongos systemd service file
    Function: firewalld.service
        Name: mongos
      Result: True
     Comment: 'mongos' was configured.
     Started: 22:35:38.133531
    Duration: 3708.856 ms
     Changes:   
              ----------
              ports:
                  ----------
                  new:
                      - 28017/tcp
                  old:
----------
          ID: mongodb server mongos service running
    Function: selinux.fcontext_policy_applied
        Name: /var/log/mongodb
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongos pidpath add, mongodb.server.config.mongodb server mongos logrotate add, mongodb.server.config.mongodb server mongos config, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongos logpath
     Started: 22:35:41.844788
    Duration: 0.004 ms
     Changes:   
----------
          ID: mongodb server mongos service running
    Function: selinux.fcontext_policy_applied
        Name: /var/run/mongodb
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongos pidpath add, mongodb.server.config.mongodb server mongos logrotate add, mongodb.server.config.mongodb server mongos config, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongos logpath
     Started: 22:35:41.845961
    Duration: 0.005 ms
     Changes:   
----------
          ID: mongodb server mongos service running
    Function: selinux.fcontext_policy_applied
        Name: /etc/mongos.conf
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongos pidpath add, mongodb.server.config.mongodb server mongos logrotate add, mongodb.server.config.mongodb server mongos config, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongos logpath
     Started: 22:35:41.847116
    Duration: 0.004 ms
     Changes:   
----------
          ID: mongodb server mongos service running
    Function: selinux.fcontext_policy_applied
        Name: /etc/logrotate.d/mongodb_mongos
      Result: False
     Comment: One or more requisite failed: mongodb.server.config.mongodb server mongos pidpath add, mongodb.server.config.mongodb server mongos logrotate add, mongodb.server.config.mongodb server mongos config, mongodb.server.config.mongodb server selinux packages, mongodb.server.config.mongodb server mongos logpath
     Started: 22:35:41.848168
    Duration: 0.003 ms
     Changes:   
----------
          ID: mongodb server mongos service running
    Function: cmd.run
        Name: firewall-cmd --add-service mongos --permanent
      Result: True
     Comment: Command "firewall-cmd --add-service mongos --permanent" run
     Started: 22:35:41.848468
    Duration: 323.276 ms
     Changes:   
              ----------
              pid:
                  13490
              retcode:
                  0
              stderr:
              stdout:
                  success
----------
          ID: mongodb server mongos service running
    Function: cmd.run
        Name: firewall-cmd --add-port=28017/tcp --permanent
      Result: True
     Comment: Command "firewall-cmd --add-port=28017/tcp --permanent" run
     Started: 22:35:42.172525
    Duration: 310.252 ms
     Changes:   
              ----------
              pid:
                  13491
              retcode:
                  0
              stderr:
              stdout:
                  success
----------
          ID: mongodb server mongos service running
    Function: cmd.run
        Name: firewall-cmd --reload
      Result: True
     Comment: Command "firewall-cmd --reload" run
     Started: 22:35:42.483517
    Duration: 1831.397 ms
     Changes:   
              ----------
              pid:
                  13492
              retcode:
                  0
              stderr:
              stdout:
                  success
----------
          ID: mongodb server mongos service running
    Function: service.running
        Name: mongos
      Result: False
     Comment: Service mongos has been enabled, and is dead
     Started: 22:35:44.316314
    Duration: 245.919 ms
     Changes:   
              ----------
              mongos:
                  True

Summary for local
-------------
Succeeded: 31 (changed=26)
Failed:    22

Steps to reproduce the bug

Expected behaviour

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

Attempts to fix the bug

Additional context

[BUG] service not launched on install

Your setup

Formula commit hash / release tag

based on dd8a5aa

Versions reports (master & minion)

[old, but not related]

Distribution: Debian/buster

Pillar / config used

[probably not relevant]

Bug details

Describe the bug

On installation (using repository), the service is not launched.

The formula contains:

  service.running:
    - name: {{ servicename }}
    - enable: True
    - onlyif: systemctl list-units | grep {{ servicename }} >/dev/null 2>&1

Steps to reproduce the bug

Install. Have the service not launched, and state.apply

Expected behaviour

Service should be launched, to ensure it is running.

Attempts to fix the bug

Removing the onlyif would start the service.

Additional context

The following command only shows something if the service is started. Stopping the service, and the command would not show anything anymore.

systemctl list-units | grep mongod

[FEATURE] Clearly show in the documentation that firewalld will be installed (or don't install firewalld)

Is your feature request related to a problem?

I think the readme should clearly shout out that the "firewalld" package will be installed and that, by doing so, a default set of firewall rules will be applied. I'll spare you a story but it took me quite a while to work out why I had lost access to several services that were completely unrelated to MongoDB by using this formula.

I might even humbly suggest that firewall package installation might be out-of-scope for a formula for MongoDB. If it configures a firewall that is already installed, that seems appropriate. Alternatively make installing firewalld optional and disabled by default.

Describe the solution you'd like

Either edit README.rst to include a clear warning that firewalld is installed, and the impact that may have or, make the installation of firewalld optional and disabled by default.

Describe alternatives you've considered

Additional context

[BUG] Issue starting services on macos launchd

Your setup

Formula commit hash / release tag

Versions reports (master & minion)

Pillar / config used


Bug details

Describe the bug

The service running states fail on macOS. See "Additional context" for full logs.

bobby@work mongodb % ls /usr/local/mongodb/mongod-4.2.6/bin/mongod
/usr/local/mongodb/mongod-4.2.6/bin/mongod

bobby@work mongodb % cat /Library/LaunchAgents/org.mongo.mongodb.mongod.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>org.mongo.mongodb.mongod</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/mongodb/mongod-4.2.6/bin/mongod </string>
      <string>--config </string>
      <string>/etc/mongodb/mongod.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/dev/null</string>
    <key>StandardOutPath</key>
    <string>/dev/null</string>
  </dict>
</plist>

bobby@work mongodb % cat /etc/mongodb/mongod.yml 
########################################################################
# File managed by Salt at <salt://mongodb/files/default/config.yml.jinja>.
# Your changes may be overwritten.
########################################################################

net:
  port: 27017
storage:
  dbPath: /var/lib/mongodb/mongod

bobby@work mongodb % cat /etc/mongodb/mongos.yml
########################################################################
# File managed by Salt at <salt://mongodb/files/default/config.yml.jinja>.
# Your changes may be overwritten.
########################################################################

sharding:
  configDB: rs1/127.0.0.1:27018

bobby@work mongodb % ps -ef | grep mongo
  501 40481 53147   0  3:36am ttys004    0:00.00 grep mongo

bobby@work mongodb % launchctl list | grep mongo                             
-	78	org.mongo.mongodb.mongod
-	78	org.mongo.mongodb.mongos

Steps to reproduce the bug

Expected behaviour

Attempts to fix the bug

Additional context

Trace

          ID: mongodb-config-usergroup-org.mongo.mongodb.mongod-install-usergroup-present
    Function: group.present
        Name: mongodb
      Result: True
     Comment: Group mongodb is present and up to date
     Started: 03:19:01.825077
    Duration: 25.939 ms
     Changes:   
----------
          ID: mongodb-config-usergroup-org.mongo.mongodb.mongod-install-usergroup-present
    Function: user.present
        Name: mongodb
      Result: True
     Comment: unless condition is true
     Started: 03:19:01.852372
    Duration: 6846.352 ms
     Changes:   
----------
          ID: mongodb-config-usergroup-org.mongo.mongodb.mongos-install-usergroup-present
    Function: group.present
        Name: mongos
      Result: True
     Comment: Group mongos is present and up to date
     Started: 03:19:08.699009
    Duration: 18.783 ms
     Changes:   
----------
          ID: mongodb-config-usergroup-org.mongo.mongodb.mongos-install-usergroup-present
    Function: user.present
        Name: mongos
      Result: True
     Comment: unless condition is true
     Started: 03:19:08.718535
    Duration: 38.969 ms
     Changes:   
----------
          ID: mongodb-install-prerequisites
    Function: pkg.installed
        Name: curl
      Result: True
     Comment: All specified packages are already installed
     Started: 03:19:08.769643
    Duration: 8274.975 ms
     Changes:   
----------
          ID: mongodb-install-prerequisites
    Function: pip.installed
        Name: pymongo
      Result: True
     Comment: Python package pymongo was already installed
              All specified packages are already installed
     Started: 03:19:17.045358
    Duration: 938.725 ms
     Changes:   
----------
          ID: mongodb-install-prerequisites
    Function: file.directory
        Name: /var/lib/mongodb
      Result: True
     Comment: The directory /var/lib/mongodb is in the correct state
     Started: 03:19:17.984824
    Duration: 2.217 ms
     Changes:   
----------
          ID: mongodb-install-prerequisites
    Function: file.directory
        Name: /tmp/downloads
      Result: True
     Comment: The directory /tmp/downloads is in the correct state
     Started: 03:19:17.987570
    Duration: 1.122 ms
     Changes:   
----------
          ID: mongodb-database-mongod-archive-install
    Function: file.directory
        Name: /usr/local/mongodb/mongod-4.2.6
      Result: True
     Comment: The directory /usr/local/mongodb/mongod-4.2.6 is in the correct state
     Started: 03:19:17.989031
    Duration: 4.838 ms
     Changes:   
----------
          ID: mongodb-database-mongod-archive-install
    Function: archive.extracted
        Name: /usr/local/mongodb/mongod-4.2.6
      Result: True
     Comment: All files in archive are already present
     Started: 03:19:17.994727
    Duration: 2343.415 ms
     Changes:   
----------
          ID: mongodb-database-org.mongo.mongodb.mongod-install-service-directory
    Function: file.directory
        Name: /var/lib/mongodb/mongod
      Result: True
     Comment: The directory /var/lib/mongodb/mongod is in the correct state
     Started: 03:19:20.338597
    Duration: 1.341 ms
     Changes:   
----------
          ID: mongodb-database-org.mongo.mongodb.mongod-install-service-launched
    Function: file.managed
        Name: /Library/LaunchAgents/org.mongo.mongodb.mongod.plist
      Result: True
     Comment: File /Library/LaunchAgents/org.mongo.mongodb.mongod.plist is in the correct state
     Started: 03:19:20.340549
    Duration: 9.637 ms
     Changes:   
----------
          ID: mongodb-database-org.mongo.mongodb.mongos-install-service-directory
    Function: file.directory
        Name: /var/lib/mongodb/mongos
      Result: True
     Comment: The directory /var/lib/mongodb/mongos is in the correct state
     Started: 03:19:20.350625
    Duration: 1.35 ms
     Changes:   
----------
          ID: mongodb-database-org.mongo.mongodb.mongos-install-service-launched
    Function: file.managed
        Name: /Library/LaunchAgents/org.mongo.mongodb.mongos.plist
      Result: True
     Comment: File /Library/LaunchAgents/org.mongo.mongodb.mongos.plist is in the correct state
     Started: 03:19:20.352578
    Duration: 6.791 ms
     Changes:   
----------
          ID: mongodb-gui-compass-macapp-download
    Function: cmd.run
        Name: curl -Lo  /tmp/downloads/guicompass1.21.2 https://downloads.mongodb.com/compass/mongodb-compass-community-1.21.2-darwin-x64.dmg
      Result: True
     Comment: unless condition is true
     Started: 03:19:20.359754
    Duration: 8.587 ms
     Changes:   
----------
          ID: mongodb-gui-compass-macapp-download
    Function: module.run
        Name: file.check_hash
      Result: True
     Comment: Module function file.check_hash executed
     Started: 03:19:20.368769
    Duration: 327.743 ms
     Changes:   
              ----------
              ret:
                  True
----------
          ID: mongodb-gui-compass-macapp-download
    Function: file.absent
        Name: /tmp/downloads/guicompass1.21.2
      Result: True
     Comment: State was not run because onfail req did not change
     Started: 03:19:20.697256
    Duration: 0.003 ms
     Changes:   
----------
          ID: mongodb-gui-compass-macapp-install
    Function: macpackage.installed
        Name: /tmp/downloads/guicompass1.21.2
      Result: True
     Comment: State was not run because none of the onchanges reqs changed
     Started: 03:19:20.697623
    Duration: 0.003 ms
     Changes:   
----------
          ID: mongodb-gui-compass-macapp-install
    Function: file.managed
        Name: /tmp/mac_shortcut.sh
      Result: True
     Comment: File /tmp/mac_shortcut.sh updated
     Started: 03:19:20.698035
    Duration: 2488.322 ms
     Changes:   
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -1,6 +1,6 @@
                   #!/usr/bin/env bash
                   
                  -Source="/Applications/Robo 3T.app"
                  +Source="/Applications/MongoDB Compass Community.app"
                   Destination="/Users/bobby/Desktop"
                   diskutil resetUserPermissions / bobby
                   /usr/bin/osascript -e "tell application \"Finder\" to make alias file to POSIX file \"$Source\" at POSIX file \"$Destination\""
----------
          ID: mongodb-gui-compass-macapp-install
    Function: cmd.run
        Name: /tmp/mac_shortcut.sh
      Result: True
     Comment: Command "/tmp/mac_shortcut.sh" run
     Started: 03:19:23.186820
    Duration: 1725.333 ms
     Changes:   
              ----------
              pid:
                  36397
              retcode:
                  0
              stderr:
              stdout:
                  Ready to reset user permissions on disk1s5 Macintosh HD
                  Started verify/repair permissions on disk1s5 Macintosh HD
                  User permissions have been reset
                  Finished verify/repair permissions on disk1s5 Macintosh HD
                  alias file MongoDB Compass Community alias 26 of folder Desktop of folder bobby of folder Users of startup disk
----------
          ID: mongodb-gui-robo3t-macapp-download
    Function: cmd.run
        Name: curl -Lo  /tmp/downloads/guirobo3t1.3.1 https://download-test.robomongo.org/mac/robo3t-1.3.1-darwin-x86_64-7419c40.dmg
      Result: True
     Comment: unless condition is true
     Started: 03:19:24.912750
    Duration: 9.713 ms
     Changes:   
----------
          ID: mongodb-gui-robo3t-macapp-install
    Function: macpackage.installed
        Name: /tmp/downloads/guirobo3t1.3.1
      Result: True
     Comment: State was not run because none of the onchanges reqs changed
     Started: 03:19:24.923532
    Duration: 0.004 ms
     Changes:   
----------
          ID: mongodb-gui-robo3t-macapp-install
    Function: file.managed
        Name: /tmp/mac_shortcut.sh
      Result: True
     Comment: File /tmp/mac_shortcut.sh updated
     Started: 03:19:24.923947
    Duration: 9.006 ms
     Changes:   
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -1,6 +1,6 @@
                   #!/usr/bin/env bash
                   
                  -Source="/Applications/MongoDB Compass Community.app"
                  +Source="/Applications/Robo 3T.app"
                   Destination="/Users/bobby/Desktop"
                   diskutil resetUserPermissions / bobby
                   /usr/bin/osascript -e "tell application \"Finder\" to make alias file to POSIX file \"$Source\" at POSIX file \"$Destination\""
----------
          ID: mongodb-gui-robo3t-macapp-install
    Function: cmd.run
        Name: /tmp/mac_shortcut.sh
      Result: True
     Comment: Command "/tmp/mac_shortcut.sh" run
     Started: 03:19:24.933271
    Duration: 1434.328 ms
     Changes:   
              ----------
              pid:
                  36416
              retcode:
                  0
              stderr:
              stdout:
                  Ready to reset user permissions on disk1s5 Macintosh HD
                  Started verify/repair permissions on disk1s5 Macintosh HD
                  User permissions have been reset
                  Finished verify/repair permissions on disk1s5 Macintosh HD
                  alias file Robo 3T alias 23 of folder Desktop of folder bobby of folder Users of startup disk
----------
          ID: mongodb-gui-robo3t-macapp-install-symlink-robo3t
    Function: file.symlink
        Name: /usr/local/bin/robo3t
      Result: True
     Comment: onlyif condition is false
     Started: 03:19:26.367868
    Duration: 16.594 ms
     Changes:   
----------
          ID: mongodb-connectors-kafka-archive-install
    Function: file.directory
        Name: /usr/local/mongodb/kafka-1.1.0
      Result: True
     Comment: The directory /usr/local/mongodb/kafka-1.1.0 is in the correct state
     Started: 03:19:26.385064
    Duration: 4.512 ms
     Changes:   
----------
          ID: mongodb-connectors-kafka-archive-install
    Function: archive.extracted
        Name: /usr/local/mongodb/kafka-1.1.0
      Result: True
     Comment: All files in archive are already present
     Started: 03:19:26.390356
    Duration: 12907.595 ms
     Changes:   
----------
          ID: mongodb-config-file-etc-file-directory
    Function: file.directory
        Name: /etc/mongodb
      Result: True
     Comment: The directory /etc/mongodb is in the correct state
     Started: 03:19:39.298425
    Duration: 1.002 ms
     Changes:   
----------
          ID: mongodb-config-file-org.mongo.mongodb.mongod-file-managed
    Function: file.managed
        Name: /etc/mongodb/mongod.yml
      Result: True
     Comment: File /etc/mongodb/mongod.yml is in the correct state
     Started: 03:19:39.300179
    Duration: 32.667 ms
     Changes:   
----------
          ID: mongodb-config-file-org.mongo.mongodb.mongos-file-managed
    Function: file.managed
        Name: /etc/mongodb/mongos.yml
      Result: True
     Comment: File /etc/mongodb/mongos.yml is in the correct state
     Started: 03:19:39.333647
    Duration: 10.677 ms
     Changes:   
----------
          ID: mongodb-config-install-mongod-environ_file
    Function: file.managed
        Name: /etc/default/mongod.sh
      Result: True
     Comment: File /etc/default/mongod.sh is in the correct state
     Started: 03:19:39.344763
    Duration: 36.145 ms
     Changes:   
----------
          ID: mongodb-service-running-prerequisites
    Function: file.managed
        Name: /etc/init.d/disable-transparent-hugepages
      Result: True
     Comment: onlyif execution failed, bad type passed
              unless condition is true
     Started: 03:19:39.381392
    Duration: 25.664 ms
     Changes:   
----------
          ID: mongodb-service-running-prerequisites
    Function: cmd.run
        Name: echo never >/sys/kernel/mm/transparent_hugepage/enabled
      Result: True
     Comment: onlyif condition is false
     Started: 03:19:39.409581
    Duration: 1.319 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod-install-datapath
    Function: file.directory
        Name: /var/lib/mongodb/mongod
      Result: True
     Comment: The directory /var/lib/mongodb/mongod is in the correct state
     Started: 03:19:39.411293
    Duration: 1.696 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod-unmasked
    Function: service.unmasked
        Name: org.mongo.mongodb.mongod
      Result: True
     Comment: onlyif condition is false
     Started: 03:19:39.413529
    Duration: 28.867 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod
    Function: service.running
        Name: org.mongo.mongodb.mongod
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/state.py", line 1981, in call
                  **cdata['kwargs'])
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/loader.py", line 1977, in wrapper
                  return f(*args, **kwargs)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/states/service.py", line 431, in running
                  before_toggle_status = __salt__['service.status'](name, sig, **status_kwargs)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/mac_service.py", line 507, in status
                  output = list_(runas=runas)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/mac_service.py", line 336, in list_
                  runas=runas)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/mac_service.py", line 295, in launchctl
                  return __utils__['mac_utils.launchctl'](sub_cmd, *args, **kwargs)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/utils/mac_utils.py", line 303, in launchctl
                  ret = __salt__['cmd.run_all'](cmd, **kwargs)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/cmdmod.py", line 932, in _run_all_quiet
                  success_retcodes=success_retcodes)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/cmdmod.py", line 422, in _run
                  user_shell = __salt__['user.info'](runas)['shell']
              NameError: name '__salt__' is not defined
     Started: 03:19:39.445774
    Duration: 5.641 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongos-unmasked
    Function: service.unmasked
        Name: org.mongo.mongodb.mongos
      Result: True
     Comment: onlyif condition is false
     Started: 03:19:39.452805
    Duration: 31.718 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongos
    Function: service.running
        Name: org.mongo.mongodb.mongos
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/state.py", line 1981, in call
                  **cdata['kwargs'])
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/loader.py", line 1977, in wrapper
                  return f(*args, **kwargs)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/states/service.py", line 431, in running
                  before_toggle_status = __salt__['service.status'](name, sig, **status_kwargs)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/mac_service.py", line 507, in status
                  output = list_(runas=runas)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/mac_service.py", line 336, in list_
                  runas=runas)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/mac_service.py", line 295, in launchctl
                  return __utils__['mac_utils.launchctl'](sub_cmd, *args, **kwargs)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/utils/mac_utils.py", line 303, in launchctl
                  ret = __salt__['cmd.run_all'](cmd, **kwargs)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/cmdmod.py", line 932, in _run_all_quiet
                  success_retcodes=success_retcodes)
                File "/usr/local/Cellar/salt/3000.2/libexec/lib/python3.7/site-packages/salt/modules/cmdmod.py", line 422, in _run
                  user_shell = __salt__['user.info'](runas)['shell']
              NameError: name '__salt__' is not defined
     Started: 03:19:39.487077
    Duration: 13.471 ms
     Changes:   

Summary for local
-------------
Succeeded: 36 (changed=5)
Failed:     2

Update to new YAML config file format in MongoDB >= 2.6

I don't have time to do this now, but I wanted to make a note of it. The current mongodb.conf file uses the old Mongo 2.4 config format. The newer format should be much easier, especially since we can have a 1:1 mapping with our pillar file. Here's the default file for reference:

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 0.0.0.0


#processManagement:

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

Note that this also switches to using syslogd, which seems like a good thing.

Manage and reconfigure replica set options don't do anything?

I'm trying to deploy some mongodb boxes and have them set up a replica set as part of the deployment. It looks like the manage/reconfigure replica set options in pillar.example are intended for that, but as far as I can tell they don't do anything.

Is this a missing feature or am I doing something wrong?

PPA instalation doesn't work on Debian 8

b-demo-dev-database:
----------
          ID: mongodb_package
    Function: pkgrepo.managed
        Name: deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/stable main
      Result: False
     Comment: Failed to configure repo 'deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/stable main': W: Failed to fetch http://repo.mongodb.org/apt/debian/dists/jessie/mongodb-org/stable/main/binary-amd64/Packages  404  Not Found

              E: Some index files failed to download. They have been ignored, or old ones used instead.
     Started: 14:36:48.904270
    Duration: 2411.306 ms
     Changes:   
----------
          ID: mongodb_package
    Function: pkg.installed
        Name: mongodb
      Result: False
     Comment: An error was encountered while installing package(s): W: Failed to fetch http://repo.mongodb.org/apt/debian/dists/jessie/mongodb-org/stable/main/binary-amd64/Packages  404  Not Found

              E: Some index files failed to download. They have been ignored, or old ones used instead.
     Started: 14:36:52.242940
    Duration: 10214.351 ms
     Changes:   
----------

[BUG] compass install fails on debian stretch

Your setup

Formula commit hash / release tag

9140a18

Versions reports (master & minion)

Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.5.3
docker-py: Not Installed
gitdb: 2.0.0
gitpython: 2.1.1
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: 1.3.7
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: 2.0.1
timelib: Not Installed
Tornado: 4.4.3
ZMQ: 4.2.1

System Versions:
dist: debian 9.11
locale: UTF-8
machine: x86_64
release: 4.9.0-11-amd64
system: Linux
version: debian 9.11

Pillar / config used

default config


Bug details

Describe the bug

On Debian Stretch, compass install fails with the following error :

                 ID: mongodb compass archive mongodb-compass-community_1.17.0_amd64.deb install
           Function: archive.extracted
               Name: /opt
             Result: False
            Comment: Could not guess archive_format from the value of the 'source' argument. Please set this archive_format to one of the following: tar, rar, zip
            Started: 14:57:07.392014
           Duration: 2.138 ms
            Changes:   
       ----------
                 ID: mongodb compass archive mongodb-compass-community_1.17.0_amd64.deb install
           Function: file.symlink
               Name: /usr/local
             Result: False
            Comment: One or more requisite failed: mongodb.compass.archive.mongodb compass archive mongodb-compass-community_1.17.0_amd64.deb install
            Started: 14:57:07.398505
           Duration: 0.018 ms
            Changes:   

Steps to reproduce the bug

run mongodb state

Expected behaviour

compass setup should be optional and should not fail

Attempts to fix the bug

I will propose a PR to make compass install optional

Additional context

Error on repo management - Ubuntu

Ubuntu 18.04 bionic
salt 2019.2.0 (Fluorine)

I am having an issue on the mongodb server package installed step:

      ID: mongodb server package repo
Function: pkgrepo.managed
    Name: deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse
  Result: True
 Comment: Configured package repo 'deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse'
 Started: 22:32:46.791737
Duration: 8136.491 ms
 Changes:   

      ID: mongodb server package installed
Function: pkg.installed
    Name: mongodb-org
  Result: False
 Comment: Problem encountered installing package(s). Additional info follows:
          
          errors:
              - Running scope as unit: run-r57bdebcd75844eab955d7d4450e171f7.scope
                E: The value 'deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse' is invalid for APT::Default-Release as such a release is not available in the sources
 Started: 22:32:54.929000
Duration: 3487.959 ms
 Changes:   

I did a little digging but am still not quite able to diagnose what could be wrong here.

pillar:

mongodb:
  server:
    use_repo: true
    version: 4.0

mongodb_db_path fights with mongo over group ownership

init.sls/mongodb_db_path enforces user and group ownership on the /var/lib/mongodb directory.

When mongodb restarts, it assigns group ownership of the files under /var/lib/mongodb/journal to nogroup.

This makes for confusing output. Any time the service restarts, the next state run will report an irrelevant change.

(platform: ubuntu 16.04. Not sure how far this generalizes)

[BUG] Failed to start mongos.service: Unit mongos.service not found.

CC: @noelmcloughlin. Note that we have 3000.3 images now so you may need to pull the latest changes first locally.


Your setup

Formula commit hash / release tag

1cd3b2c

Versions reports (master & minion)

N/a.

Pillar / config used

As provided in kitchen.yml.


Bug details

Describe the bug

All instances failing after the merge of #79:

                 ID: mongodb server mongos service running
           Function: service.running
               Name: mongos
             Result: False
            Comment: Failed to start mongos.service: Unit mongos.service not found.
            Started: 14:25:41.181355
           Duration: 133.196 ms
            Changes: 

Steps to reproduce the bug

Run Travis for that commit or even latest.

Expected behaviour

All should be passing, as they were before:

                 ID: mongodb server mongos service running
           Function: service.running
               Name: mongos
             Result: True
            Comment: Service mongos has been enabled, and is running
            Started: 20:11:57.614548
           Duration: 455.365 ms
            Changes:   
              ----------
              mongos:
                  True

Attempts to fix the bug

Additional context

Conflicting logrotate scripts

This formula installs a script to /etc/logrotate.d/mongodb, but doesn't disable the one that comes with the package, /etc/logrotate.d/mongodb-server. This causes cron to spit out duplicate log entry errors every time it runs. This logrotate script only exists in the standard Ubuntu package, mongodb-server (2.4.9-1ubuntu2), not in mongodb-org from their PPA.

PPA installation doesn't work in Ubuntu 14.04

Here's the output:

----------
          ID: mongodb_db_path
    Function: file.directory
        Name: /mongodb/data
      Result: True
     Comment: Directory /mongodb/data updated
     Changes:
              ----------
              /mongodb/data:
                  New Dir
----------
          ID: mongodb_log_path
    Function: file.directory
        Name: /mongodb/log
      Result: True
     Comment: Directory /mongodb/log updated
     Changes:
              ----------
              /mongodb/log:
                  New Dir
----------
          ID: mongodb_configuration
    Function: file.managed
        Name: /etc/mongod.conf
      Result: True
     Comment: File /etc/mongod.conf updated
     Changes:
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: mongodb_service
    Function: service.running
        Name: mongod
      Result: False
     Comment: Failed to start the service
     Changes:
              ----------
              mongod:
                  False
----------
          ID: mongodb_logrotate
    Function: file.managed
        Name: /etc/logrotate.d/mongodb
      Result: True
     Comment: File /etc/logrotate.d/mongodb updated
     Changes:
              ----------
              diff:
                  New file
              mode:
                  0440

Summary
-------------
Succeeded: 35
Failed:     3
-------------
Total:     38

State 'mongodb' in SLS 'mongodb' is not formed as a list

Hello,

I'm using a very slightly modified version of the example pillar, but when I try to run salt ( sudo salt-call --local state.apply -l debug), I get the following error:

local:
    Data failed to compile:
----------
    State 'mongodb' in SLS 'mongodb' is not formed as a list
----------
    State 'mongodb' in SLS 'mongodb' is not formed as a list

The "not formed as a list" error is repeated 11 times. My pillar file passes a yamllint.com check. Any suggestions why salt is rejecting it?

Thanks!


/srv/salt/pillar/mongodb.sls:

## For versions of Mongo that use the YAML format for configuration, use the
## following. All entries in mongod_settings are written to the config file
## verbatim. The storage:dbPath and systemLog:path entries are required in
## this usage and take precedence over db_path at the top level (see references
## in mongodb/init.sls).
mongodb:
  use_repo: True
  version: 3.2 # use oldstable in for 1.8 - 2.6
  repo_component: main
  mongodb_package: mongodb-org
  mongodb_user: mongodb
  mongodb_group: mongodb
  mongod: mongod
  conf_path: /etc/mongod.conf
  log_path: /mongodb/log
  db_path: /mongodb/data
  mongod_settings:
    systemLog:
      destination: file
      logAppend: true
      path: /var/log/mongodb/mongod.log
    storage:
      dbPath: /var/lib/mongodb
      journal:
        enabled: true
    net:
      port: 27017
      bindIp: 0.0.0.0
    setParameter:
      textSearchEnabled: true

/srv/salt/minion.yml:

master: localhost

file_client: local

state_verbose: True

gitfs_provider: gitpython

fileserver_backend:
  - roots
  - git

gitfs_remotes:
  - https://github.com/saltstack-formulas/node-formula.git
  - https://github.com/saltstack-formulas/mongodb-formula.git
  - https://github.com/saltstack-formulas/mysql-formula.git

file_roots:
  base:
    - /srv/salt/
    - /srv/salt/roots/
    - /srv/salt/pillar/

pillar_roots:
  base:
    - /srv/salt/pillar/

/srv/salt/pillar/top.sls:

base:
  '*':
    - node
    - mongodb

Without PPA installation doesn't work in Ubuntu 14.04

See the output:


----------
          ID: mongodb_db_path
    Function: file.directory
        Name: /mongodb/data
      Result: True
     Comment: Directory /mongodb/data updated
     Changes:
              ----------
              /mongodb/data:
                  New Dir
----------
          ID: mongodb_log_path
    Function: file.directory
        Name: /mongodb/log
      Result: True
     Comment: Directory /mongodb/log updated
     Changes:
              ----------
              /mongodb/log:
                  New Dir
----------
          ID: mongodb_configuration
    Function: file.managed
        Name: /etc/mongod.conf
      Result: True
     Comment: File /etc/mongod.conf updated
     Changes:
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: mongodb_service
    Function: service.running
        Name: mongod
      Result: False
     Comment: Failed to start the service
     Changes:
              ----------
              mongod:
                  False
----------
          ID: mongodb_logrotate
    Function: file.managed
        Name: /etc/logrotate.d/mongodb
      Result: True
     Comment: File /etc/logrotate.d/mongodb updated
     Changes:
              ----------
              diff:
                  New file
              mode:
                  0440

Summary
------------
Succeeded: 5
Failed:    1
------------
Total:     6

Logrotate issue on Centos

The logrotate does not work properly on Centos as the lock file is not stored in /var/lib/mongodb/mongod.lock but in /var/lib/mongo/mongod.lock.

[BUG] Issue with Systemd service unit. Possibly only effects newer versions of MongoDB

Your setup

Formula commit hash / release tag

6977ccf

Versions reports (master & minion)

Pillar / config used

wanted:
  database:
    - mongod
    - shell
pkg:
  deps:
    - python3-pip
  database:
    mongod:
      version: 4.4.1
      use_upstream: 'archive'
      config:
        storage:
          dbPath: /var/lib/mongodb/mongod

Bug details

Describe the bug

I'm attempting to install a reasonably standard installation of MongoDB on Ubuntu 20.04 using this formula (obviously).

Unless I'm mistaken, with MongoDB 4.4.1 (the latest version at the time of writing), is not using the conf file that this formula creates in /etc/mongodb/mongod.conf. The symptom it presents is the daemon failing to start and the following error in the system journal:

"NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."

If you edit the systemd unit file in /lib/systemd/system/mongod.service and change the ExecStart= line to the following, it works:

ExecStart=/usr/local/mongodb/mongod-4.4.1/bin/mongod -f /etc/mongodb/mongod.conf

I'm happy to create a PR that adds the command line argument but I'm not sure of:

  • Does this only effect mongodb versions newer than some version? If so, Which version?
  • I don't have access to systems other than Ubuntu to test on. If the GitHub automated testing handles other platforms, great, if not, I'll need some help testing.

Steps to reproduce the bug

Expected behaviour

Attempts to fix the bug

Additional context

Question about best practices with this formula

I think I'm realizing that this formula was set up with batteries included, and that's why I'm having a hard time with it.

In my environment, I would like to set up mongod in a 3 node replica set, but I don't need sharding or the BI connector.

Say I want to override that behavior, and simply give a replset name, and not set up sharding or BI. Could somebody help me with an example pillar set up?

Edit: Am I correct to assume that the hard-coding of svc in https://github.com/saltstack-formulas/mongodb-formula/blob/master/mongodb/server/config.sls means that what I'm asking for isn't possible from a pillar config?

[BUG] tries to run mongodb service instead of mongod on debian stretch

Your setup

Formula commit hash / release tag

9140a18

Versions reports (master & minion)

Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.5.3
docker-py: Not Installed
gitdb: 2.0.0
gitpython: 2.1.1
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: 1.3.7
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: 2.0.1
timelib: Not Installed
Tornado: 4.4.3
ZMQ: 4.2.1

System Versions:
dist: debian 9.11
locale: UTF-8
machine: x86_64
release: 4.9.0-11-amd64
system: Linux
version: debian 9.11

Pillar / config used

default config


Bug details

Describe the bug

On Debian Stretch, the formula tries to launch a "mongodb" service and fails. The installed service is named mongod (without a trailing b)

       16:16:41.776024 [ 38.593 ms]       file.managed    Clean     Name: /usr/lib/systemd/system/mongod.service
       ----------
                 ID: mongodb server mongod service running
           Function: service.running
               Name: mongodb
             Result: False
            Comment: The named service mongodb is not available
            Started: 16:16:41.821027
           Duration: 12.692 ms
            Changes:   

Steps to reproduce the bug

run mongodb state

Expected behaviour

The formula successfully created the /usr/lib/systemd/system/mongod.service file. It should run the service with the same name.

Attempts to fix the bug

none

Additional context

Various issues encountered when implementing `semantic-release`

Implemented semantic-release in #73. Came across a number of issues when rolling that out. Collecting them here for future reference.


https://travis-ci.org/myii/mongodb-formula/builds/618386706

  • While I managed to get the Debian-based platforms working, all of the rest are failing badly.

Will need a better way to deal with version numbers and keys:

  • Debian-8: 4.0
  • The rest: 4.2

Installation and keys (per version):


Compass download and installation:


CC: @noelmcloughlin.

[FEATURE] three minor fixes to consider

Is your feature request related to a problem?

Describe the solution you'd like

General issue

  • The mongod.sh file contains superfluous {} line
bobby@work kubernetes % cat /etc/default/mongod.sh 
########################################################################
# File managed by Salt at <salt://mongodb/files/default/environ.sh.jinja>.
# Your changes may be overwritten.
########################################################################

export PATH=${PATH}:/usr/local/mongodb/mongod-4.2.6
{}

On MacOS-

  • The formula should manage mongod.sh in /etc/defaults/ not /etc/default/
          ID: mongodb-config-install-mongod-environ_file
    Function: file.managed
        Name: /etc/default/mongod.sh
      Result: True
     Comment: File /etc/default/mongod.sh is in the correct state
     Started: 20:43:29.766874
    Duration: 22.894 ms
  • There should be symlinks from /usr/local/mongo-xxxx/bin/cmd to /usr/local/bin/cmd
bobby@work % ls /usr/local/mongodb/mongod-4.2.6/bin 
bsondump	mongo		mongodump	mongofiles	mongoreplay	mongos		mongotop
install_compass	mongod		mongoexport	mongoimport	mongorestore	mongostat

Describe alternatives you've considered

Additional context

Need to restore ability to set version

We don't need to pin to a specific (patch) version, but at least to a minor version that matches the URL of the deb repo. e.g. "3.0", "3.2", etc. == ''http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2". I think this should be a really easy change.

Inexplicably, they have included RC versions in their "stable" repo: http://repo.mongodb.org/apt/ubuntu/dists/trusty/mongodb-org/stable/multiverse/binary-amd64/Packages shows Version: 3.2.0rc2143~gdeaf4af (they have since added the final 3.2.0). I definitely want to be able to check out any potential breaking changes before upgrading to a new (even minor) version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.