Skip to content
Permalink
Browse files

Merge pull request #39 from codenize-tools/0.3.0

release v0.3.0
  • Loading branch information...
aibou committed Oct 29, 2018
2 parents 635adc2 + bf1cd72 commit 2e8a850ced134572a456b5ab9cff493c50f2c8b0
Showing with 33 additions and 6 deletions.
  1. +1 −0 .rspec
  2. +0 −1 .travis.yml
  3. +23 −3 bin/piculet
  4. +1 −0 lib/piculet.rb
  5. +1 −1 lib/piculet/version.rb
  6. +5 −1 lib/piculet/wrapper/security-group.rb
  7. +2 −0 piculet.gemspec
1 .rspec
@@ -2,3 +2,4 @@
--require spec_helper
--require rspec/instafail
--format RSpec::Instafail
--format progress
@@ -3,7 +3,6 @@ language: ruby
rvm:
- 2.0.0
script:
- bundle install
- bundle exec rake
env:
global:
@@ -52,6 +52,10 @@ ARGV.options do |opt|
opt.on('' , '--debug') { options[:debug] = true }
opt.parse!

credentials_path ||= ENV['AWS_CONFIG_FILE']
profile_name ||= ENV['AWS_DEFAULT_PROFILE'] || ENV['AWS_PROFILE']
region ||= ENV['AWS_DEFAULT_REGION']

aws_opts = {}
if access_key and secret_key
aws_opts = {
@@ -60,9 +64,25 @@ ARGV.options do |opt|
}
elsif profile_name or credentials_path
credentials_opts = {}
credentials_opts[:profile_name] = profile_name if profile_name
credentials_opts[:path] = credentials_path if credentials_path
provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new(credentials_opts)
if credentials_path
credentials_opts[:path] = credentials_path
AWSConfig.credentials_file = credentials_path
end
if profile_name
credentials_opts[:profile_name] = profile_name
role_arn = AWSConfig[profile_name][:role_arn]
end
if role_arn
session_name = "piculet-session-#{Time.now.to_i}"
sts = AWS::STS.new(AWSConfig[profile_name].config_hash)
provider = AWS::Core::CredentialProviders::AssumeRoleProvider.new(
sts: sts,
role_arn: role_arn,
role_session_name: session_name
)
else
provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new(credentials_opts)
end
aws_opts[:credential_provider] = provider
elsif (access_key and !secret_key) or (!access_key and secret_key) or mode.nil?
puts opt.help
@@ -10,6 +10,7 @@
require 'ipaddr'

require 'aws-sdk-v1'
require 'aws_config'

require 'piculet/ext/ec2-owner-id-ext'
require 'piculet/ext/security-group'
@@ -1,3 +1,3 @@
module Piculet
VERSION = "0.2.9"
VERSION = "0.3.0"
end
@@ -7,7 +7,7 @@ class SecurityGroup

def_delegators(
:@security_group,
:vpc_id, :name, :vpc?)
:vpc_id, :name)

def initialize(security_group, options)
@security_group = security_group
@@ -42,6 +42,10 @@ def delete
end
end

def vpc?
!!@security_group
end

def tags
h = {}
@security_group.tags.map {|k, v| h[k] = v }
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
spec.add_dependency "term-ansicolor", ">= 1.2.2"
spec.add_dependency "diffy"
spec.add_dependency "hashie"
spec.add_dependency "nokogiri", "~> 1.8.2"
spec.add_dependency "aws_config", "0.1.0"

#spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }

0 comments on commit 2e8a850

Please sign in to comment.
You can’t perform that action at this time.