-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
854 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/.bundle/ | ||
/.yardoc | ||
/Gemfile.lock | ||
/_yardoc/ | ||
/coverage/ | ||
/doc/ | ||
/pkg/ | ||
/spec/reports/ | ||
/tmp/ | ||
*.bundle | ||
*.so | ||
*.o | ||
*.a | ||
mkmf.log | ||
.idea | ||
bundler.d/Gemfile.local.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec | ||
|
||
group :development do | ||
gem 'smart_proxy', :git => "https://github.com/theforeman/smart-proxy", :branch => "develop" | ||
gem 'pry' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Smart-proxy Dynflow plugin | ||
|
||
This a plugin for foreman smart-proxy allowing using dynflow for the | ||
[remote execution](http://theforeman.github.io/foreman_remote_execution/) | ||
|
||
## Installation | ||
|
||
Add this line to your smart proxy bundler.d/dynflow.rb gemfile: | ||
|
||
```ruby | ||
gem 'smart_proxy_dynflow | ||
``` | ||
And then execute: | ||
$ bundle | ||
Or install it yourself as: | ||
$ gem install smart_proxy_dynflow | ||
## Usage | ||
To configure this plugin you can use template from settings.d/dynflow.yml.example. | ||
You must place dynflow.yml config file (based on this template) to your | ||
smart-proxy config/settings.d/ directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'rake' | ||
require 'rake/testtask' | ||
require "bundler/gem_tasks" | ||
|
||
desc 'Default: run unit tests.' | ||
task :default => :test | ||
|
||
desc 'Test Dynflow plugin.' | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << '.' | ||
t.libs << 'lib' | ||
t.libs << 'test' | ||
t.test_files = FileList['test/**/*_test.rb'] | ||
t.verbose = true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gem 'smart_proxy_dynflow' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
require 'dynflow' | ||
|
||
require 'smart_proxy_dynflow/version' | ||
require 'smart_proxy_dynflow/plugin' | ||
|
||
class Proxy::Dynflow | ||
|
||
attr_reader :world | ||
|
||
def initialize | ||
@world = create_world | ||
end | ||
|
||
def create_world(options = {}) | ||
options = default_world_options.merge(options) | ||
::Dynflow::SimpleWorld.new(options) | ||
end | ||
|
||
def persistence_conn_string | ||
ENV['DYNFLOW_DB_CONN_STRING'] || 'sqlite:/' | ||
end | ||
|
||
def persistence_adapter | ||
::Dynflow::PersistenceAdapters::Sequel.new persistence_conn_string | ||
end | ||
|
||
def default_world_options | ||
{ logger_adapter: logger_adapter, | ||
persistence_adapter: persistence_adapter } | ||
end | ||
|
||
def logger_adapter | ||
::Dynflow::LoggerAdapters::Simple.new $stderr, 1 | ||
end | ||
|
||
def web_console | ||
require 'dynflow/web_console' | ||
world = @world | ||
dynflow_console = ::Dynflow::WebConsole.setup do | ||
set :world, world | ||
end | ||
dynflow_console | ||
end | ||
|
||
class << self | ||
attr_reader :instance | ||
|
||
def initialize | ||
@instance = Proxy::Dynflow.new | ||
end | ||
|
||
def world | ||
instance.world | ||
end | ||
end | ||
end | ||
|
||
|
||
Proxy::Dynflow.initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
map "/dynflow" do | ||
run Proxy::Dynflow.instance.web_console | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Proxy::Dynflow | ||
class Plugin < Proxy::Plugin | ||
http_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__)) | ||
https_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__)) | ||
|
||
settings_file "dynflow.yml" | ||
default_settings :dynflow_identity_key => '~/.vagrant.d/insecure_private_key', | ||
:dynflow_user => 'root' | ||
plugin :dynflow, Proxy::Dynflow::VERSION | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Proxy | ||
class Dynflow | ||
VERSION = '0.0.1' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
:enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- encoding: utf-8 -*- | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'smart_proxy_dynflow/version' | ||
|
||
Gem::Specification.new do |gem| | ||
gem.name = "smart_proxy_dynflow" | ||
gem.version = Proxy::Dynflow::VERSION | ||
gem.authors = ['Ivan Nečas'] | ||
gem.email = ['[email protected]'] | ||
gem.homepage = "https://github.com/theforeman/smart_proxy_dynflow" | ||
gem.summary = %q{Dynflow runtime for Foreman smart proxy} | ||
gem.description = <<-EOS | ||
Use the Dynflow in side Foreman smart proxy | ||
EOS | ||
|
||
gem.files = Dir['{bundler.d,lib,settings.d}/**/*', 'LICENSE', 'Gemfile'] | ||
gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) | ||
gem.require_paths = ["lib"] | ||
gem.license = 'GPLv3' | ||
|
||
gem.add_development_dependency "bundler", "~> 1.7" | ||
gem.add_development_dependency "rake", "~> 10.0" | ||
gem.add_development_dependency('test-unit', '~> 2') | ||
gem.add_development_dependency('mocha', '~> 1') | ||
gem.add_development_dependency('webmock', '~> 1') | ||
gem.add_development_dependency('rack-test', '~> 0') | ||
gem.add_development_dependency('rake', '~> 10') | ||
|
||
gem.add_runtime_dependency('dynflow') | ||
gem.add_runtime_dependency('sequel') | ||
gem.add_runtime_dependency('sqlite3') | ||
end | ||
|