Skip to content

[master] Add Salt package type to versions report and grain#64446

Merged
s0undt3ch merged 10 commits intosaltstack:masterfrom
Ch3LL:add_onedir_grains
Aug 4, 2023
Merged

[master] Add Salt package type to versions report and grain#64446
s0undt3ch merged 10 commits intosaltstack:masterfrom
Ch3LL:add_onedir_grains

Conversation

@Ch3LL
Copy link
Contributor

@Ch3LL Ch3LL commented Jun 9, 2023

What does this PR do?

Adds the package type to the Salt versions type and adds a grain.
This value will be either 'system' or 'onedir'

What issues does this PR fix or reference?

Fixes: #62961
Fixes: #62589

Previous Behavior

Could not determine package type in Salt.

New Behavior

Can determine package type either via versions report or calling the grain.

New Versions Report:

Salt Version:
                  Salt: 3006.1+404.gc417f2609a
 
Python Version:
                Python: 3.10.9 (main, Feb  3 2023, 08:04:26) [GCC 12.2.1 20230111]
 
Dependency Versions:
                  cffi: 1.14.6
              cherrypy: unknown
              dateutil: 2.8.2
             docker-py: 6.0.1
                 gitdb: Not Installed
             gitpython: Not Installed
                Jinja2: 3.1.2
               libgit2: Not Installed
          looseversion: 1.0.2
              M2Crypto: Not Installed
                  Mako: 1.2.4
               msgpack: 1.0.2
          msgpack-pure: Not Installed
          mysql-python: Not Installed
             packaging: 23.1
             pycparser: 2.21
              pycrypto: Not Installed
          pycryptodome: 3.9.8
                pygit2: Not Installed
          python-gnupg: 0.4.8
                PyYAML: 5.4.1
                 PyZMQ: 25.1.0
                relenv: 0.7.0
                 smmap: Not Installed
               timelib: 0.2.4
               Tornado: 6.3.2
                   ZMQ: 4.3.4
 
Salt Extensions:
 pytest-salt-factories: 1.0.0rc23
  saltext.salt-convert: 0.1.dev28+g54c1336
 saltext.salt-describe: 0.1.dev157+g1bbb6c1
 
Salt Package Information:
          Package Type: system
 
System Versions:
                  dist: manjaro 22.1.3 Talos
                locale: utf-8
               machine: x86_64
               release: 6.1.31-1-MANJARO
                system: Linux
               version: Manjaro Linux 22.1.3 Talos

New grain type:

(py-3.10)  ch3ll@megan-precision5550  ~/git/salt   add_onedir_grains <B>  salt-call --local grains.get package
local:
    system

@Ch3LL Ch3LL requested a review from a team as a code owner June 9, 2023 18:35
@Ch3LL Ch3LL requested review from cmcmarrow and removed request for a team June 9, 2023 18:35
@salt-project-bot-prod-environment salt-project-bot-prod-environment bot changed the title Add Salt package type to versions report and grain [master] Add Salt package type to versions report and grain Jun 9, 2023
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 18:51 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 18:51 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 18:51 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 18:52 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 19:05 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 19:11 — with GitHub Actions Inactive
@Ch3LL Ch3LL changed the title [master] Add Salt package type to versions report and grain [WIP] [master] Add Salt package type to versions report and grain Jun 9, 2023
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 20:15 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 20:15 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 20:15 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 20:15 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 20:15 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 20:15 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 21:07 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 21:07 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 21:07 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 21:07 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 21:07 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 9, 2023 21:07 — with GitHub Actions Inactive
@ITJamie
Copy link
Contributor

ITJamie commented Jun 11, 2023

It would be great if this was a grain that was fully self contained, that would mean it could be synced to older minions.

I understand while its currently written to use a module but having this be code that syncs from the master to all existing minion versions would be useful.

@Ch3LL Ch3LL force-pushed the add_onedir_grains branch from 53027aa to 84730f3 Compare June 13, 2023 19:32
@Ch3LL Ch3LL temporarily deployed to ci June 13, 2023 19:48 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 20, 2023 20:05 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 20, 2023 20:05 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 20, 2023 20:05 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 20, 2023 20:05 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 01:11 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 01:11 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 01:11 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 01:11 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 01:12 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 01:12 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 13:02 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 13:02 — with GitHub Actions Inactive
@Ch3LL Ch3LL temporarily deployed to ci June 21, 2023 13:02 — with GitHub Actions Inactive
Test that the package grain returns onedir
"""
ret = salt_cli.run("grains.get", "package", minion_tgt=salt_minion.id)
assert "onedir" == ret.data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert "onedir" == ret.data
assert ret.data == "onedir"

Assert what we get against what we expect. Looks more logical in case of failures on pytest diff's

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be placed in salt/.

When you pip install salt, where does this file land? site-packages/_pkg.txt?



@pytest.fixture(scope="package", autouse=True)
def onedir_env():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def onedir_env():
def _onedir_env():

Since it's an auto use fixture, let's prefix it with _ so that it gets hidden on the possible fixtures to use shown by pytest.

@Ch3LL
Copy link
Contributor Author

Ch3LL commented Aug 2, 2023

@s0undt3ch this is ready, but I believe it clashes with your pytest factories PR. Did you want to merge this one in first or yours? The new pytest fixtures Iadd will need to be removed when your PR is added

@Ch3LL
Copy link
Contributor Author

Ch3LL commented Aug 2, 2023

okay I just merged in your PR #63334

I'll go ahead and update this PR now

@s0undt3ch
Copy link
Contributor

@s0undt3ch this is ready, but I believe it clashes with your pytest factories PR. Did you want to merge this one in first or yours? The new pytest fixtures Iadd will need to be removed when your PR is added

Sorry, totally missed this message.

@Ch3LL
Copy link
Contributor Author

Ch3LL commented Aug 7, 2023

@meaksh just thought you would want to be aware of this new change for packaging purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

3 participants