Skip to main content

System information discovery and asset tracking

Project description

System information discovery and asset tracking

INSTALLATION

pip install corn

INSTALLATION FOR DEVELOPMENT

Clone the corn repo and install with pip:

git clone https://gitlab.com/saltstack/pop/corn.git
pip install -e corn

EXECUTION

After installation the corn command should now be available.

The command will have no output until it is vertically extended (details below).

TESTING

install requirements-test.txt with pip and run pytest:

pip install -r corn/requirements-test.txt
pytest corn/tests

VERTICAL APP-MERGING

Instructions for extending corn

Install pop:

pip install --upgrade pop

Create a new directory for the project:

mkdir corn_{project_name}
cd corn_{project_name}

Use pop-seed to generate the structure of a project that extends corn:

pop-seed -t v corn_{project_name} -d corn

  • “-t v” specifies that this is a vertically app-merged project

  • “-d corn” says that we want to implement the dynamic name of “corn”

Notice that some structure has been created for you. We especially care about the new directory in corn_{project_name}/corn

Add “corn” to the requirements.txt:

echo "corn" >> requirements.txt

CREATING CORNS

  • Create a new file in “corn_{project_name}/corn”
    • The directory should already have been created by pop-seed.

    • The file name is arbitrary.

    • Every file in this directory, then it’s subdirectories, will be parsed “simultaneously” (as far as that makes sense for asyncio).

    • Corns that are dependant on each other should be assigned in the same function.

    • Do NOT rely on the collector’s recursion strategy for corns to depend on each other.

  • Add your new project to the python path
    • alternatively, run “pip install -e .” from your project’s root directory
      • you only need to do this once

  • Create an async function in this file with a descriptive yet arbitrary name
    • By convention it should start with “load”

    • Make it async unless you have a really really really good reason.

    • Grains that depend on each other already belong in the same function, don’t depend on synchronous programming for determinism

    • Corns can be accessed and assigned like a dictionary, but our convention is to use the namespace

Example:

async def load_my_corn(hub):
    hub.corn.CORN.new_corn = "Hello World!"

And that’s it! Now verify that your corn is collected from the command line:

corn new_corn

Output:

new_corn:
    Hello World!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

corn-7.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

corn-7.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file corn-7.2.tar.gz.

File metadata

  • Download URL: corn-7.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for corn-7.2.tar.gz
Algorithm Hash digest
SHA256 e21376556ccf225677b4036c0d99d88573bd35bd89b86d64574fb26ac662512c
MD5 77966316794bc4dd208591ae3814b896
BLAKE2b-256 7bf0a67cfcd53b78c30f0c4518dfab0f3d186879af158e82f11c6becdabec754

See more details on using hashes here.

File details

Details for the file corn-7.2-py3-none-any.whl.

File metadata

  • Download URL: corn-7.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for corn-7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 50819aa3d640646a58d907c755c0df070e7589b0d5335847be49f7a546e360a1
MD5 caa9d6ff4f0ad4a8ff6f48afe8455800
BLAKE2b-256 28071d84f732a751903d235d4636da908837a55055c1fa7cb74b94365dc71214

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page