Skip to content

Add a production and development CLI#143

Merged
ehelms merged 1 commit intotheforeman:masterfrom
ehelms:alt-prototype-obsah
May 8, 2025
Merged

Add a production and development CLI#143
ehelms merged 1 commit intotheforeman:masterfrom
ehelms:alt-prototype-obsah

Conversation

@ehelms
Copy link
Member

@ehelms ehelms commented May 7, 2025

This is an alternative to #131 where I use the method of a simple bash script outlined by #131 (comment).

I have also used this method to create the idea of a "development CLI" instead of bash scripts to show how we can encapsulate the development tasks into a similar CLI style for developers. This is also a way we could onboard additional CLIs in production if we wanted to have separate commands rather than actions.

This only adds ./forge start-vms but if we like the idea, I will adjust the other scripts also.

This aims for the following layout:

  • src - production code
  • development - development and testing tools
  • docs - documentation
  • tests - directory for tests and fixtures

rop
OBSAH_NAME=rop
OBSAH_DATA=src
OBSAH_INVENTORY=./inventories/
export OBSAH_NAME OBSAH_DATA OBSAH_INVENTORY
Copy link
Member Author

Choose a reason for hiding this comment

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

We'll need to disable extra vars and add to this list, I opened theforeman/obsah#76 to do so.

@ehelms ehelms force-pushed the alt-prototype-obsah branch 3 times, most recently from 58c6280 to c88af8d Compare May 7, 2025 13:10
@ehelms ehelms changed the title Alternative Prototyping CLI based on Obsah Add a production and development CLI May 7, 2025
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I'm trying to wrap my head around what we all have.

  • (semi-)transformation of our Ansible data into a collection for production
  • Rewrite of development/testing tooling into a collection
  • Add wrapper scripts

Did I get that right?

uses: ansible/ansible-lint@main
with:
requirements_file: requirements.yml
requirements_file: ../requirements.yml
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering if we should move requirements.yml into src instead so I looked up how a collection is structured. https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_structure.html tells me we should have a galaxy.yml in the same directory as roles and playbooks.

We can ignore it for now but where I'd like to head to is that we can point obsah at a collection and it can just do the right thing.

@ehelms
Copy link
Member Author

ehelms commented May 7, 2025

'm trying to wrap my head around what we all have.

  • (semi-)transformation of our Ansible data into a collection for production
  • Rewrite of development/testing tooling into a collection
  • Add wrapper scripts

Did I get that right?

I think the "semi" is correct, as this keeps that option available without explicitly defining one yet. And as you note, the development parts are also taking the same shape now. Turning our development and testing actions into a developer focused CLI using wrapper scripts.

@ehelms ehelms force-pushed the alt-prototype-obsah branch 3 times, most recently from 779a9b2 to a23a5fa Compare May 7, 2025 17:12
@ehelms
Copy link
Member Author

ehelms commented May 7, 2025

The same test keeps failing, but doesn't fail for me locally:

=========================== short test summary info ============================
FAILED tests/client_test.py::test_foreman_content_view - AssertionError: assert False
 +  where False = <package bear>.is_installed
 +    where <package bear> = <class 'testinfra.modules.base.RpmPackage'>('bear')
 +      where <class 'testinfra.modules.base.RpmPackage'> = <testinfra.host.Host paramiko://client>.package
======= 1 failed, 68 passed, 2 xfailed, 9 warnings in 237.13s (0:03:57) ========

Looks like due to network issue, maybe I broke the etc_hosts setup?

DEBUG    testinfra:base.py:323 RUN CommandResult(backend=<testinfra.backend.paramiko.ParamikoBackend object at 0x7f6425b69430>, exit_status=1, command=b'sudo /bin/sh -c \'set -o pipefail && curl --silent --show-error  --insecure \'"\'"\'https://192.168.121.108/register?activation_keys=f2c48070-f55e-41bd-9643-07d74df32545&organization_id=3\'"\'"\' --header \'"\'"\'Authorization: ***'"\'"\' | bash\'', _stdout=b'#\n# Running registration\n#\nsubscription-manager is already installed!\n', _stderr=b'Network error: Name or service not known (error code -2)\n')

This was referenced May 7, 2025
@ehelms ehelms force-pushed the alt-prototype-obsah branch from a23a5fa to 4499671 Compare May 8, 2025 13:18
@ehelms ehelms force-pushed the alt-prototype-obsah branch from 4499671 to 4f2b5f2 Compare May 8, 2025 14:09
Copy link
Member

@evgeni evgeni left a comment

Choose a reason for hiding this comment

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

I am sure we can find enough things to improve, but let's get the current state in and iterate later.

@ehelms ehelms force-pushed the alt-prototype-obsah branch 2 times, most recently from c81573f to 19f7f3e Compare May 8, 2025 15:51
Signed-off-by: Eric D. Helms <ericdhelms@gmail.com>
@ehelms ehelms force-pushed the alt-prototype-obsah branch from 19f7f3e to 234f264 Compare May 8, 2025 16:10
@ehelms ehelms merged commit b344cdb into theforeman:master May 8, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants