Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cursor Commands

Collection of scripts for running commands on remote hosts and managing host preparation.

Scripts

run_commands_on_host.py

Main script for running command groups on one or more remote hosts.

Features:

  • Support for multiple hosts (comma-separated)
  • Command groups for different purposes (prep_for_jenkins, maintenance, etc.)
  • Automatic log file creation and download
  • Summary reporting

Usage:

# Single host with default config
python3 run_commands_on_host.py myhost.example.com prep_for_jenkins

# Multiple hosts
python3 run_commands_on_host.py "host1,host2,host3" system_info

# With custom config file
python3 run_commands_on_host.py "host1,host2" prep_for_jenkins my_config.json

# List available command groups
python3 run_commands_on_host.py myhost.example.com --list

Output:

  • Creates log files on remote hosts (/tmp/host_prep_*.log)
  • Downloads logs to local host_logs/ directory
  • Shows summary with success/failure status

cleanup_logs.py

Utility script to clean up old log files.

Usage:

# List log files
python3 cleanup_logs.py list

# Clean up old logs (keep 10 most recent)
python3 cleanup_logs.py cleanup

# Clean up old logs (keep N most recent)
python3 cleanup_logs.py cleanup 20

provision_host.py

Script to provision Beaker hosts with RHEL distributions.

Features:

  • Provision exact host with exact RHEL version
  • Provision exact host with latest RHEL-X.Y
  • Provision exact host with RHEL-X.Y that has specific kernel version
  • Automatic job XML generation and submission

Usage:

# Scenario 1: Provision with exact distro name
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com RHEL-10.2-20251103.1

# Scenario 2: Provision with latest RHEL version
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com latest 10.1

# Scenario 3: Provision with specific kernel version
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com kernel 9.6 5.14.0-636

# Watch job after submission
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com latest 10.1 --watch

Options:

  • --watch, -w: Watch the job after submission
  • --no-bkr: Do not use bkr-distros-list (use web scraping instead)

Output:

  • Generates job XML file: job_<hostname>.xml
  • Submits job to Beaker and returns job ID
  • Provides job URL for tracking

Dependencies:

  • Requires bkr command line tool (beaker-client)
  • Requires valid Kerberos authentication (kinit before use)

Configuration Files

commands_groups_config.json

Main configuration file with command groups. Default config file used by run_commands_on_host.py.

Structure:

  • ssh_user: SSH username (default: root)
  • ssh_options: SSH command line options
  • timeout: Command timeout in seconds
  • command_groups: Dictionary of command groups
    • prep_for_jenkins: Prepare host for Jenkins jobs
    • maintenance: Maintenance commands
    • cleanup: Cleanup commands
    • system_info: System information gathering

commands_config.json

Legacy configuration file (backward compatibility). Uses simple commands array format.

Directory Structure

cursor-commands/
├── README.md
├── requirements.txt
├── run_commands_on_host.py
├── cleanup_logs.py
├── provision_host.py
├── find_kernel_version.py
├── commands_groups_config.json
├── commands_config.json
└── host_logs/          # Created automatically for downloaded logs

Examples

Prepare multiple hosts for Jenkins

python3 run_commands_on_host.py "host1,host2,host3" prep_for_jenkins

Gather system info from hosts

python3 run_commands_on_host.py "host1.example.com,host2.example.com" system_info

Run maintenance on a single host

python3 run_commands_on_host.py myhost.example.com maintenance

Provision a Beaker host

# Provision with latest RHEL 10.1
python3 provision_host.py ampere-one-x-08.khw.eng.bos2.dc.redhat.com latest 10.1

# Provision with exact RHEL version
python3 provision_host.py ampere-one-x-07.khw.eng.bos2.dc.redhat.com RHEL-10.2-20251103.1

Installation

Install Python dependencies:

pip install -r requirements.txt

Note: For provision_host.py, you also need:

  • beaker-client package (provides bkr command)
  • Valid Kerberos authentication (kinit before use)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages