panoramix 0.7.15 → 0.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| @@ -6,10 +6,13 @@ module Panoramix | |
| 6 6 | 
             
                class DockerBuild < DockerImageBase
         | 
| 7 7 |  | 
| 8 8 | 
             
                  attr_reader :src
         | 
| 9 | 
            +
                  attr_reader :env
         | 
| 9 10 |  | 
| 10 | 
            -
                  def initialize(dst, src)
         | 
| 11 | 
            -
                    super(dst)
         | 
| 11 | 
            +
                  def initialize(dst, src, host)
         | 
| 12 | 
            +
                    super(dst, host)
         | 
| 12 13 | 
             
                    @src = src
         | 
| 14 | 
            +
                    @env = Hash.new
         | 
| 15 | 
            +
                    @env["DOCKER_HOST"] = "tcp://#{host}" if host
         | 
| 13 16 | 
             
                  end
         | 
| 14 17 |  | 
| 15 18 | 
             
                  # When this instance needs to be executed
         | 
| @@ -20,7 +23,7 @@ module Panoramix | |
| 20 23 |  | 
| 21 24 | 
             
                  # Default action for this task
         | 
| 22 25 | 
             
                  def run_default
         | 
| 23 | 
            -
                    shell | 
| 26 | 
            +
                    shell("docker build -t #{dst} #{File.dirname(@src)}", false, @env)
         | 
| 24 27 | 
             
                  end
         | 
| 25 28 |  | 
| 26 29 | 
             
                  def ps
         | 
| @@ -56,6 +59,9 @@ def docker_build(args, &block) | |
| 56 59 | 
             
                raise message
         | 
| 57 60 | 
             
              end
         | 
| 58 61 |  | 
| 62 | 
            +
              # Select the host
         | 
| 63 | 
            +
              host = config.fetch(:host, nil)
         | 
| 64 | 
            +
             | 
| 59 65 | 
             
              # Select provided dependencies
         | 
| 60 66 | 
             
              prerequisites = args[name].select { |d| ! d.is_a? Hash }
         | 
| 61 67 |  | 
| @@ -63,7 +69,7 @@ def docker_build(args, &block) | |
| 63 69 | 
             
              prerequisites = prerequisites.push(dockerfile) unless dockerfile.nil?
         | 
| 64 70 | 
             
              prerequisites.flatten!
         | 
| 65 71 |  | 
| 66 | 
            -
              instance = Panoramix::Plugin::DockerBuild.new(name, dockerfile)
         | 
| 72 | 
            +
              instance = Panoramix::Plugin::DockerBuild.new(name, dockerfile, host)
         | 
| 67 73 |  | 
| 68 74 | 
             
              descriptions = I18n.t('docker_build')
         | 
| 69 75 | 
             
              descriptions = Hash.new if descriptions.class != Hash
         | 
| @@ -6,10 +6,13 @@ module Panoramix | |
| 6 6 | 
             
            		class DockerImage < DockerImageBase
         | 
| 7 7 |  | 
| 8 8 | 
             
            			attr_reader :src
         | 
| 9 | 
            +
            			attr_reader :env
         | 
| 9 10 |  | 
| 10 | 
            -
            			def initialize(dst, src)
         | 
| 11 | 
            -
            				super(dst)
         | 
| 11 | 
            +
            			def initialize(dst, src, host)
         | 
| 12 | 
            +
            				super(dst, host)
         | 
| 12 13 | 
             
            				@src = src
         | 
| 14 | 
            +
            				@env = Hash.new
         | 
| 15 | 
            +
            				@env["DOCKER_HOST"] = "tcp://#{host}" if host
         | 
| 13 16 | 
             
            			end
         | 
| 14 17 |  | 
| 15 18 | 
             
            			# When this instance needs to be executed
         | 
| @@ -19,13 +22,13 @@ module Panoramix | |
| 19 22 |  | 
| 20 23 | 
             
            			# Default action for this task
         | 
| 21 24 | 
             
            			def run_default
         | 
| 22 | 
            -
            				shell | 
| 25 | 
            +
            				shell("docker pull #{@src}", false, @env) unless ENV["NO_PULL"]
         | 
| 23 26 |  | 
| 24 27 | 
             
            				# Tag image with required tag
         | 
| 25 | 
            -
            				shell | 
| 28 | 
            +
            				shell("docker tag #{@src} #{@dst}", false, @env)
         | 
| 26 29 |  | 
| 27 30 | 
             
            				# Remove origin image
         | 
| 28 | 
            -
            				shell | 
| 31 | 
            +
            				shell("docker rmi #{@src}", false, @env)
         | 
| 29 32 | 
             
            			end
         | 
| 30 33 |  | 
| 31 34 | 
             
            			def ps
         | 
| @@ -42,9 +45,11 @@ def external_docker_image(args, block) | |
| 42 45 | 
             
            	name = args.keys[0]
         | 
| 43 46 | 
             
            	src = args[name][:dockerimage] || args[name][:docker]
         | 
| 44 47 |  | 
| 48 | 
            +
            	host = args[name][:host] || nil
         | 
| 49 | 
            +
             | 
| 45 50 | 
             
            	prerequisites = []
         | 
| 46 51 |  | 
| 47 | 
            -
            	instance = Panoramix::Plugin::DockerImage.new(name, src)
         | 
| 52 | 
            +
            	instance = Panoramix::Plugin::DockerImage.new(name, src, host)
         | 
| 48 53 |  | 
| 49 54 | 
             
            	descriptions = I18n.t('docker_image')
         | 
| 50 55 | 
             
            	descriptions = Hash.new if descriptions.class != Hash
         | 
| @@ -7,10 +7,14 @@ module Panoramix | |
| 7 7 | 
             
                class DockerImageBase < Base
         | 
| 8 8 |  | 
| 9 9 | 
             
                  attr_reader :dst
         | 
| 10 | 
            +
                  attr_reader :tag
         | 
| 11 | 
            +
                  attr_reader :env
         | 
| 10 12 |  | 
| 11 | 
            -
                  def initialize(dst)
         | 
| 13 | 
            +
                  def initialize(dst, host)
         | 
| 12 14 | 
             
                    @dst = dst
         | 
| 13 15 | 
             
                    @tag = "latest"
         | 
| 16 | 
            +
                    @env = Hash.new
         | 
| 17 | 
            +
                    @env["DOCKER_HOST"] = "tcp://#{host}" if host
         | 
| 14 18 | 
             
                  end
         | 
| 15 19 |  | 
| 16 20 | 
             
                  # Return timestamp of the image
         | 
| @@ -19,7 +23,7 @@ module Panoramix | |
| 19 23 | 
             
                    if info
         | 
| 20 24 | 
             
                      # Get image timestamp
         | 
| 21 25 | 
             
                      id = info.split(" ")[0]
         | 
| 22 | 
            -
                      time = shell("docker inspect -f {{.Created}} #{id}", true)[:out]
         | 
| 26 | 
            +
                      time = shell("docker inspect -f {{.Created}} #{id}", true, @env)[:out]
         | 
| 23 27 | 
             
                      return Time.parse(time)
         | 
| 24 28 | 
             
                    else
         | 
| 25 29 | 
             
                      return Time.at 0
         | 
| @@ -30,7 +34,7 @@ module Panoramix | |
| 30 34 | 
             
                  def created?
         | 
| 31 35 | 
             
                    return @created if @created
         | 
| 32 36 |  | 
| 33 | 
            -
                    info = shell("docker images", true)[:out]
         | 
| 37 | 
            +
                    info = shell("docker images", true, @env)[:out]
         | 
| 34 38 |  | 
| 35 39 | 
             
                    images_list = info.split("\n")
         | 
| 36 40 | 
             
                    images_list.shift
         | 
| @@ -44,7 +48,7 @@ module Panoramix | |
| 44 48 | 
             
                    info = created?
         | 
| 45 49 | 
             
                    if info
         | 
| 46 50 | 
             
                      id = info.split(" ")[0]
         | 
| 47 | 
            -
                      shell | 
| 51 | 
            +
                      shell("docker rmi -f #{id}", false, @env)
         | 
| 48 52 | 
             
                    end 
         | 
| 49 53 | 
             
                  end
         | 
| 50 54 |  | 
| @@ -12,10 +12,13 @@ module Panoramix | |
| 12 12 | 
             
            			attr_reader :src
         | 
| 13 13 | 
             
            			attr_reader :env
         | 
| 14 14 |  | 
| 15 | 
            -
            			def initialize(dst, src, env)
         | 
| 15 | 
            +
            			def initialize(dst, src, env, host)
         | 
| 16 16 | 
             
            				@dst = dst
         | 
| 17 17 | 
             
            				@src = src
         | 
| 18 18 | 
             
            				@env = env
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            				@env = parse_env @env.keys
         | 
| 21 | 
            +
            				@env["DOCKER_HOST"] = "tcp://#{host}" unless host.nil?
         | 
| 19 22 | 
             
            			end
         | 
| 20 23 |  | 
| 21 24 | 
             
            			# Return current timestamp for the container
         | 
| @@ -54,7 +57,6 @@ module Panoramix | |
| 54 57 |  | 
| 55 58 | 
             
            			# Default action for this task
         | 
| 56 59 | 
             
            			def run_default
         | 
| 57 | 
            -
            				@env = parse_env @env.keys
         | 
| 58 60 | 
             
            				# Raise an exception if already has been created
         | 
| 59 61 | 
             
            				if created?
         | 
| 60 62 | 
             
            					message = I18n.t('errors.docker_up.cluster_deployed', {:id => @dst})
         | 
| @@ -108,7 +110,7 @@ module Panoramix | |
| 108 110 | 
             
            	    	puts "Service: #{@dst}"
         | 
| 109 111 | 
             
            				if created?
         | 
| 110 112 | 
             
                      puts "Timestamp: #{timestamp}"
         | 
| 111 | 
            -
                      info = shell(" | 
| 113 | 
            +
                      info = shell("#{@compose} -p #{@dst} -f #{@src} ps", true, @env)[:out]
         | 
| 112 114 | 
             
            		    	puts info
         | 
| 113 115 | 
             
            				else
         | 
| 114 116 | 
             
            					puts "Timestamp: Not created"
         | 
| @@ -153,11 +155,14 @@ def docker_up(args, &block) | |
| 153 155 | 
             
            	# Get environment
         | 
| 154 156 | 
             
            	environment = parse_env(compose_params.first[:env] || [])
         | 
| 155 157 |  | 
| 158 | 
            +
            	 # Select the host
         | 
| 159 | 
            +
              host = compose_params[0].fetch(:host, nil)
         | 
| 160 | 
            +
             | 
| 156 161 | 
             
            	# Merge deps with the compose file_task
         | 
| 157 162 | 
             
            	prerequisites = deps.select { |d| ! d.is_a? Hash }
         | 
| 158 163 | 
             
            	prerequisites = prerequisites.push(compose)
         | 
| 159 164 |  | 
| 160 | 
            -
            	instance = Panoramix::Plugin::DockerUp.new(name, compose, environment)
         | 
| 165 | 
            +
            	instance = Panoramix::Plugin::DockerUp.new(name, compose, environment, host)
         | 
| 161 166 |  | 
| 162 167 | 
             
            	descriptions = I18n.t('docker_up')
         | 
| 163 168 | 
             
            	descriptions = Hash.new if descriptions.class != Hash
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: panoramix
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.7. | 
| 4 | 
            +
              version: 0.7.16
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2016-03- | 
| 12 | 
            +
            date: 2016-03-31 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: pry
         | 
| @@ -113,25 +113,25 @@ executables: [] | |
| 113 113 | 
             
            extensions: []
         | 
| 114 114 | 
             
            extra_rdoc_files: []
         | 
| 115 115 | 
             
            files:
         | 
| 116 | 
            -
            - lib/panoramix | 
| 117 | 
            -
            - lib/panoramix/ | 
| 118 | 
            -
            - lib/panoramix/ | 
| 119 | 
            -
            - lib/panoramix/tasks/actions.rb
         | 
| 116 | 
            +
            - lib/panoramix.rb
         | 
| 117 | 
            +
            - lib/panoramix/locale.rb
         | 
| 118 | 
            +
            - lib/panoramix/plugin/cfn.rb
         | 
| 120 119 | 
             
            - lib/panoramix/plugin/docker_image.rb
         | 
| 121 | 
            -
            - lib/panoramix/plugin/base.rb
         | 
| 122 | 
            -
            - lib/panoramix/plugin/env.rb
         | 
| 123 | 
            -
            - lib/panoramix/plugin/docker_image_base.rb
         | 
| 124 120 | 
             
            - lib/panoramix/plugin/docker_up.rb
         | 
| 125 | 
            -
            - lib/panoramix/plugin/docker_build.rb
         | 
| 126 121 | 
             
            - lib/panoramix/plugin/s3.rb
         | 
| 127 | 
            -
            - lib/panoramix/plugin/cfn.rb
         | 
| 128 122 | 
             
            - lib/panoramix/plugin/git.rb
         | 
| 123 | 
            +
            - lib/panoramix/plugin/base.rb
         | 
| 124 | 
            +
            - lib/panoramix/plugin/env.rb
         | 
| 125 | 
            +
            - lib/panoramix/plugin/docker_build.rb
         | 
| 126 | 
            +
            - lib/panoramix/plugin/docker_image_base.rb
         | 
| 129 127 | 
             
            - lib/panoramix/plugin/wget.rb
         | 
| 130 | 
            -
            - lib/panoramix/ | 
| 131 | 
            -
            - lib/panoramix/mpi.rb
         | 
| 128 | 
            +
            - lib/panoramix/dsl.rb
         | 
| 132 129 | 
             
            - lib/panoramix/external.rb
         | 
| 130 | 
            +
            - lib/panoramix/tasks/task_mpi.rb
         | 
| 131 | 
            +
            - lib/panoramix/tasks/global_tasks.rb
         | 
| 132 | 
            +
            - lib/panoramix/tasks/actions.rb
         | 
| 133 | 
            +
            - lib/panoramix/mpi.rb
         | 
| 133 134 | 
             
            - lib/panoramix/panoramix_core.rb
         | 
| 134 | 
            -
            - lib/panoramix.rb
         | 
| 135 135 | 
             
            - locales/en.yml
         | 
| 136 136 | 
             
            homepage: https://github.com/sflyr
         | 
| 137 137 | 
             
            licenses:
         |