File tree 4 files changed +8
-3
lines changed
4 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 3
3
license "Apache 2.0"
4
4
description "Configures apt and apt services and an LWRP for managing apt repositories"
5
5
long_description IO . read ( File . join ( File . dirname ( __FILE__ ) , 'README.md' ) )
6
- version "1.3 .0"
6
+ version "1.4 .0"
7
7
8
8
recipe "apt" , "Runs apt-get update during compile phase and sets up preseed directories"
9
9
recipe "apt::cacher" , "Set up an APT cache"
Original file line number Diff line number Diff line change 1
1
action :add do
2
- if Chef :: Extensions . wan_up? && !::File . exists? ( "/etc/apt/sources.list.d/#{ new_resource . repo_name } -source.list" )
2
+ if new_resource . wan_up? && !::File . exists? ( "/etc/apt/sources.list.d/#{ new_resource . repo_name } -source.list" )
3
3
Chef ::Log . info "Adding #{ new_resource . repo_name } repository to /etc/apt/sources.list.d/#{ new_resource . repo_name } -source.list"
4
4
add_key!
5
5
create_or_update_repository!
Original file line number Diff line number Diff line change 17
17
# limitations under the License.
18
18
#
19
19
20
+ wan_up = `ping -c 1 -W 1 google.com` . index ( /1 (?:packets )?received/ )
20
21
21
- if Chef :: Extensions . wan_up?
22
+ if wan_up
22
23
chef_apt_update = ENV . fetch ( 'CHEF_APT_UPDATE' ) { '' }
23
24
execute "apt-get update" unless chef_apt_update . index ( "disable" )
24
25
end
Original file line number Diff line number Diff line change @@ -15,3 +15,7 @@ def initialize(*args)
15
15
super
16
16
@action = :add
17
17
end
18
+
19
+ def wan_up?
20
+ `ping -c 1 -W 1 google.com` . index ( /1 (?:packets )?received/ )
21
+ end
You can’t perform that action at this time.
0 commit comments