Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #469 from worxli/feature-add-ssh-ip
Browse files Browse the repository at this point in the history
Add config for container SSH IP
  • Loading branch information
Virgil Dupras authored Jul 23, 2018
2 parents 50cbe5a + f71de42 commit 5a1f6ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/vagrant-lxc/action/fetch_ip_with_lxc_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def assigned_ip(env)
fetch_ip_tries = config.fetch_ip_tries
driver = env[:machine].provider.driver
ip = ''
return config.ssh_ip_addr if not config.ssh_ip_addr.nil?
retryable(:on => LXC::Errors::ExecuteError, :tries => fetch_ip_tries, :sleep => 3) do
unless ip = get_container_ip_from_ip_addr(driver)
# retry
Expand Down
4 changes: 4 additions & 0 deletions lib/vagrant-lxc/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Config < Vagrant.plugin("2", :config)

attr_accessor :fetch_ip_tries

attr_accessor :ssh_ip_addr

# Whether the container needs to be privileged. Defaults to true (unprivileged containers
# is a very new feature in vagrant-lxc). If false, will try creating an unprivileged
# container. If it can't, will revert to the old "sudo wrapper" method to create a privileged
Expand All @@ -37,6 +39,7 @@ def initialize
@container_name = UNSET_VALUE
@tmpfs_mount_size = UNSET_VALUE
@fetch_ip_tries = UNSET_VALUE
@ssh_ip_addr = UNSET_VALUE
@privileged = UNSET_VALUE
end

Expand Down Expand Up @@ -66,6 +69,7 @@ def finalize!
@existing_container_name = nil if @existing_container_name == UNSET_VALUE
@tmpfs_mount_size = '2G' if @tmpfs_mount_size == UNSET_VALUE
@fetch_ip_tries = 10 if @fetch_ip_tries == UNSET_VALUE
@ssh_ip_addr = nil if @ssh_ip_addr == UNSET_VALUE
@privileged = true if @privileged == UNSET_VALUE
end
end
Expand Down

0 comments on commit 5a1f6ab

Please sign in to comment.