continuum-stager-api 0.2.2 → 0.2.3
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/apcera-stager-api-contrib.gemspec +1 -1
- data/lib/apcera/stager/stager.rb +16 -0
- data/spec/apcera/stager/stager_spec.rb +13 -0
- data/spec/tmp/.gitkeep +0 -0
- metadata +4 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2e3a6b627ab832440fc2d6b7898a3aa0d256dc31
         | 
| 4 | 
            +
              data.tar.gz: 57d827c7d0f5d08be7b4f28d7fb192b953faeca3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f19532a6fed320b883dd772f8d474c5e040e84fad64f42ac09d6a526cdfd03a715be05e4dab5b3389bc438b55052d20c7e015c9458ddf9afd5a9d39bac303c17
         | 
| 7 | 
            +
              data.tar.gz: 9bc33cfcf83b60529ceb0bc38b6ff39d8b697770a1607ce78896896391d044789f82d9b238b83f7de08006947d6bba0d57caafb12d6dd9fd9c7e89bbeedbcc5a
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/LICENSE
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -65,7 +65,7 @@ apc app create someapp --staging=mystager --start | |
| 65 65 |  | 
| 66 66 | 
             
            The MIT License (MIT)
         | 
| 67 67 |  | 
| 68 | 
            -
            Copyright (c) 2014 Apcera
         | 
| 68 | 
            +
            Copyright (c) 2014-2015 Apcera
         | 
| 69 69 |  | 
| 70 70 | 
             
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 71 71 | 
             
            of this software and associated documentation files (the "Software"), to deal
         | 
| @@ -15,7 +15,7 @@ Gem::Specification.new do |gem| | |
| 15 15 | 
             
              gem.test_files    = `git ls-files -- {spec}/*`.split("\n")
         | 
| 16 16 | 
             
              gem.name          = "continuum-stager-api"
         | 
| 17 17 | 
             
              gem.require_paths = ["lib"]
         | 
| 18 | 
            -
              gem.version       = "0.2. | 
| 18 | 
            +
              gem.version       = "0.2.3"
         | 
| 19 19 |  | 
| 20 20 | 
             
              gem.add_development_dependency 'rspec', '~> 2.6.0'
         | 
| 21 21 | 
             
              gem.add_development_dependency 'rake'
         | 
    
        data/lib/apcera/stager/stager.rb
    CHANGED
    
    | @@ -14,6 +14,22 @@ module Apcera | |
| 14 14 | 
             
                  setup_environment
         | 
| 15 15 | 
             
                end
         | 
| 16 16 |  | 
| 17 | 
            +
                # Setup /stagerfs chroot environment so it is ready to run commands
         | 
| 18 | 
            +
                # from pulled in dependencies. This does the following:
         | 
| 19 | 
            +
                # - Setup working resolv.conf
         | 
| 20 | 
            +
                # - Bind mounts /proc to /stagerfs/proc
         | 
| 21 | 
            +
                # - Recursively bind mounts /dev to /stagerfs/dev
         | 
| 22 | 
            +
                def setup_chroot
         | 
| 23 | 
            +
                  execute("sudo mkdir -p /stagerfs/etc")
         | 
| 24 | 
            +
                  execute("sudo cp /etc/resolv.conf /stagerfs/etc/resolv.conf")
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  execute("sudo mkdir -p /stagerfs/proc")
         | 
| 27 | 
            +
                  execute("sudo mount --bind /proc /stagerfs/proc")
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  execute("sudo mkdir -p /stagerfs/dev")
         | 
| 30 | 
            +
                  execute("sudo mount --rbind /dev /stagerfs/dev")
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
             | 
| 17 33 | 
             
                # Download a package from the staging coordinator.
         | 
| 18 34 | 
             
                # We use Net::HTTP here because it supports streaming downloads.
         | 
| 19 35 | 
             
                def download
         | 
| @@ -58,6 +58,19 @@ describe Apcera::Stager do | |
| 58 58 | 
             
                  FileUtils.rm_rf Dir.glob(test_files)
         | 
| 59 59 | 
             
                end
         | 
| 60 60 |  | 
| 61 | 
            +
                context "setup_chroot" do
         | 
| 62 | 
            +
                  it "should setup a working chrooted environment in /stagerfs" do
         | 
| 63 | 
            +
                    @stager.should_receive(:execute).with("sudo mkdir -p /stagerfs/etc")
         | 
| 64 | 
            +
                    @stager.should_receive(:execute).with("sudo cp /etc/resolv.conf /stagerfs/etc/resolv.conf")
         | 
| 65 | 
            +
                    @stager.should_receive(:execute).with("sudo mkdir -p /stagerfs/proc")
         | 
| 66 | 
            +
                    @stager.should_receive(:execute).with("sudo mount --bind /proc /stagerfs/proc")
         | 
| 67 | 
            +
                    @stager.should_receive(:execute).with("sudo mkdir -p /stagerfs/dev")
         | 
| 68 | 
            +
                    @stager.should_receive(:execute).with("sudo mount --rbind /dev /stagerfs/dev")
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                    @stager.setup_chroot
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
                end
         | 
| 73 | 
            +
             | 
| 61 74 | 
             
                context "download" do
         | 
| 62 75 | 
             
                  it "should download the app package to pkg.tar.gz" do
         | 
| 63 76 | 
             
                    VCR.use_cassette('download') do
         | 
    
        data/spec/tmp/.gitkeep
    ADDED
    
    | 
            File without changes
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: continuum-stager-api
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Josh Ellithorpe
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-09-24 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rest-client
         | 
| @@ -161,6 +161,7 @@ files: | |
| 161 161 | 
             
            - spec/fixtures/cassettes/templates_remove.yml
         | 
| 162 162 | 
             
            - spec/fixtures/cassettes/upload.yml
         | 
| 163 163 | 
             
            - spec/spec_helper.rb
         | 
| 164 | 
            +
            - spec/tmp/.gitkeep
         | 
| 164 165 | 
             
            homepage: http://apcera.com
         | 
| 165 166 | 
             
            licenses:
         | 
| 166 167 | 
             
            - MIT
         | 
| @@ -181,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 181 182 | 
             
                  version: '0'
         | 
| 182 183 | 
             
            requirements: []
         | 
| 183 184 | 
             
            rubyforge_project: 
         | 
| 184 | 
            -
            rubygems_version: 2. | 
| 185 | 
            +
            rubygems_version: 2.4.8
         | 
| 185 186 | 
             
            signing_key: 
         | 
| 186 187 | 
             
            specification_version: 4
         | 
| 187 188 | 
             
            summary: Continuum Stager api library which makes it super easy to write stagers for
         |