Skip to content

Commit

Permalink
Platform framework and detect DSL (#209)
Browse files Browse the repository at this point in the history
* Refactor platform classes and add platform DSL

Signed-off-by: Jared Quick <[email protected]>

* Add unknown default for mock os

Signed-off-by: Jared Quick <[email protected]>
  • Loading branch information
jquick authored and adamleff committed Nov 15, 2017
1 parent e0f8369 commit 3ed2adb
Show file tree
Hide file tree
Showing 42 changed files with 1,557 additions and 1,043 deletions.
1 change: 1 addition & 0 deletions lib/train.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'train/options'
require 'train/plugins'
require 'train/errors'
require 'train/platforms'
require 'uri'

module Train
Expand Down
3 changes: 3 additions & 0 deletions lib/train/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ class ClientError < ::StandardError; end
# Base exception class for all exceptions that are caused by other failures
# in the transport layer.
class TransportError < ::StandardError; end

# Exception for when no platform can be detected
class PlatformDetectionFailed < ::StandardError; end
end
1 change: 0 additions & 1 deletion lib/train/extras.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

module Train::Extras
require 'train/extras/command_wrapper'
require 'train/extras/os_common'
require 'train/extras/stat'

CommandResult = Struct.new(:stdout, :stderr, :exit_status)
Expand Down
60 changes: 0 additions & 60 deletions lib/train/extras/linux_lsb.rb

This file was deleted.

151 changes: 0 additions & 151 deletions lib/train/extras/os_common.rb

This file was deleted.

34 changes: 0 additions & 34 deletions lib/train/extras/os_detect_arista_eos.rb

This file was deleted.

40 changes: 0 additions & 40 deletions lib/train/extras/os_detect_darwin.rb

This file was deleted.

22 changes: 0 additions & 22 deletions lib/train/extras/os_detect_esx.rb

This file was deleted.

Loading

7 comments on commit 3ed2adb

@coderanger
Copy link

Choose a reason for hiding this comment

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

This broke compat with any existing transport plugins. This should have been a major release.

@chris-rock
Copy link
Contributor

Choose a reason for hiding this comment

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

@coderanger we kept the supported train api stable. You need to be more specific about what has not worked out for you.

@coderanger
Copy link

Choose a reason for hiding this comment

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

@chris-rock The API for defining a transport changed without compat since you used to have to define the OS recognition as part of the plugin and OSCommon is gone now.

@chris-rock
Copy link
Contributor

Choose a reason for hiding this comment

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

If I am getting you right, you are using internal data structures. OSCommon is no public supported API for Train.

@coderanger
Copy link

Choose a reason for hiding this comment

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

How else do you define a new transport plugin?

@chris-rock
Copy link
Contributor

Choose a reason for hiding this comment

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

We were thinking about the feature to extend the transport but we had no community request to do so until now.

@coderanger
Copy link

Choose a reason for hiding this comment

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

I put in the PR months ago :) Until you merge that, I have to maintain the Kubernetes plugin outside of Train.

Please sign in to comment.