Skip to content

refactor: split main driver file into focused modules#235

Merged
ramereth merged 4 commits intomainfrom
refactor/split-driver-file
Apr 3, 2026
Merged

refactor: split main driver file into focused modules#235
ramereth merged 4 commits intomainfrom
refactor/split-driver-file

Conversation

@ramereth
Copy link
Copy Markdown
Contributor

@ramereth ramereth commented Apr 2, 2026

Resolves #24 - the main openstack.rb driver file had grown too large
with too many concerns in a single class.

Extract four new modules from Kitchen::Driver::Openstack:

  • Config (openstack/config.rb): server naming logic including
    config_server_name, default_name, and server_name_prefix
  • Networking (openstack/networking.rb): floating IP allocation and IP
    address resolution including attach_ip, attach_ip_from_pool, get_ip,
    get_public_private_ips, filter_ips, and parse_ips
  • ServerHelper (openstack/server_helper.rb): server creation and
    resource finders including create_server, init_configuration,
    optional_config, find_image, find_flavor, find_network, and
    find_matching
  • Helpers (openstack/helpers.rb): ohai hints, SSL validation, and
    server wait logic including add_ohai_hint, disable_ssl_validation,
    wait_for_server, and countdown

The main openstack.rb retains the class definition, create/destroy
lifecycle methods, Fog connection helpers, and default_config
declarations.

Additional changes:

  • Fix Style/ClassVars offenses by replacing class variables with
    constants (IP_POOL_LOCK in Networking, DEFAULT_CREATION_TIMEOUT
    in Volume)
  • Fix Style/FileRead by using File.read and updating the corresponding
    spec mock
  • Remove obsolete --chefstyle flag from Rakefile (no longer supported
    by newer RuboCop; .rubocop.yml already loads cookstyle via require)
  • Auto-correct all cookstyle offenses (string quoting, comment format,
    percent literal delimiters)
  • Add Lance Albertson as author and Oregon State University copyright

Signed-off-by: Lance Albertson lance@osuosl.org

Description

Please describe what this change achieves

Issues Resolved

List any existing issues this PR resolves, or any Discourse or
StackOverflow discussions that are relevant

Type of Change

Our release process assumes you are using Conventional Commit messages.

The most important prefixes you should have in mind are:

  • _fix_: which represents bug fixes, and correlates to a SemVer patch.
  • _feat_: which represents a new feature, and correlates to a SemVer minor.
  • _feat!_:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a major version change.

If you have not included a conventional commit message this can be fixed on merge.

Check List

ramereth added 3 commits April 2, 2026 16:53
Resolves #24 - the main openstack.rb driver file had grown too large
with too many concerns in a single class.

Extract four new modules from Kitchen::Driver::Openstack:

- Config (openstack/config.rb): server naming logic including
  config_server_name, default_name, and server_name_prefix
- Networking (openstack/networking.rb): floating IP allocation and IP
  address resolution including attach_ip, attach_ip_from_pool, get_ip,
  get_public_private_ips, filter_ips, and parse_ips
- ServerHelper (openstack/server_helper.rb): server creation and
  resource finders including create_server, init_configuration,
  optional_config, find_image, find_flavor, find_network, and
  find_matching
- Helpers (openstack/helpers.rb): ohai hints, SSL validation, and
  server wait logic including add_ohai_hint, disable_ssl_validation,
  wait_for_server, and countdown

The main openstack.rb retains the class definition, create/destroy
lifecycle methods, Fog connection helpers, and default_config
declarations.

Additional changes:
- Fix Style/ClassVars offenses by replacing class variables with
  constants (IP_POOL_LOCK in Networking, DEFAULT_CREATION_TIMEOUT
  in Volume)
- Fix Style/FileRead by using File.read and updating the corresponding
  spec mock
- Remove obsolete --chefstyle flag from Rakefile (no longer supported
  by newer RuboCop; .rubocop.yml already loads cookstyle via require)
- Auto-correct all cookstyle offenses (string quoting, comment format,
  percent literal delimiters)
- Add Lance Albertson as author and Oregon State University copyright

Signed-off-by: Lance Albertson <lance@osuosl.org>
Update Rakefile to use 'cookstyle --chefstyle' instead of
RuboCop::RakeTask with the unsupported --chefstyle flag. The
--chefstyle flag is handled by the cookstyle binary, not by RuboCop
directly.

Remove the require directive from .rubocop.yml since --chefstyle
handles config loading internally.

Auto-correct all chefstyle offenses (double-quoted strings,
%i{} delimiters).

Signed-off-by: Lance Albertson <lance@osuosl.org>
Signed-off-by: Lance Albertson <lance@osuosl.org>
@ramereth ramereth force-pushed the refactor/split-driver-file branch from e7b7ac9 to 7ff3ec5 Compare April 3, 2026 00:16
@ramereth ramereth requested a review from Stromweld April 3, 2026 00:16
@jjasghar
Copy link
Copy Markdown
Contributor

jjasghar commented Apr 3, 2026

It's good to see this plugin still is humming along. 🫡

Stromweld
Stromweld previously approved these changes Apr 3, 2026
Copy link
Copy Markdown
Contributor

@Stromweld Stromweld left a comment

Choose a reason for hiding this comment

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

LGTM, Only recommendation would be to change copilot-instructions to AGENTS.md file and put it in the root directory. This just makes it more universal for all agent types. Contents don't need to be changed.
https://agents.md/

Signed-off-by: Lance Albertson <lance@osuosl.org>
@ramereth ramereth merged commit 633e8f1 into main Apr 3, 2026
6 checks passed
@ramereth ramereth deleted the refactor/split-driver-file branch April 3, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split up main driver file

3 participants