Skip to content

Commit 8cadd96

Browse files
committed
Move noask_file_text to platform
This really depends on the platform and doesn't belong in the file abstraction.
1 parent af27326 commit 8cadd96

3 files changed

Lines changed: 46 additions & 37 deletions

File tree

lib/beaker/host/unix/file.rb

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -155,43 +155,9 @@ def repo_type
155155
# @raise [ArgumentError] If called on a host with a platform that's not Solaris
156156
#
157157
# @return [String] the text of the noask file
158+
# @deprecated Use {Beaker::Platform#noask_file_text} instead
158159
def noask_file_text
159-
if self['platform'].variant == 'solaris' && self['platform'].version == '10'
160-
noask = <<~NOASK
161-
# Write the noask file to a temporary directory
162-
# please see man -s 4 admin for details about this file:
163-
# http://www.opensolarisforum.org/man/man4/admin.html
164-
#
165-
# The key thing we don't want to prompt for are conflicting files.
166-
# The other nocheck settings are mostly defensive to prevent prompts
167-
# We _do_ want to check for available free space and abort if there is
168-
# not enough
169-
mail=
170-
# Overwrite already installed instances
171-
instance=overwrite
172-
# Do not bother checking for partially installed packages
173-
partial=nocheck
174-
# Do not bother checking the runlevel
175-
runlevel=nocheck
176-
# Do not bother checking package dependencies (We take care of this)
177-
idepend=nocheck
178-
rdepend=nocheck
179-
# DO check for available free space and abort if there isn't enough
180-
space=quit
181-
# Do not check for setuid files.
182-
setuid=nocheck
183-
# Do not check if files conflict with other packages
184-
conflict=nocheck
185-
# We have no action scripts. Do not check for them.
186-
action=nocheck
187-
# Install to the default base directory.
188-
basedir=default
189-
NOASK
190-
else
191-
msg = "noask file text unknown for platform '#{self['platform']}'"
192-
raise ArgumentError, msg
193-
end
194-
noask
160+
self['platform'].noask_file_text
195161
end
196162

197163
protected

lib/beaker/host/unix/pkg.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def install_package(name, cmdline_args = '', version = nil, opts = {})
107107
when /solaris-10/
108108
if !check_for_command('pkgutil')
109109
# https://www.opencsw.org/package/pkgutil/
110-
noask_text = self.noask_file_text
110+
noask_text = self['platform'].noask_file_text
111111
noask_file = File.join(external_copy_base, 'noask')
112112
create_remote_file(self, noask_file, noask_text)
113113
execute("pkgadd -d http://get.opencsw.org/now -a #{noask_file} -n all", opts)

lib/beaker/platform.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,48 @@ def timesync_packages
156156
%w[ntpdate]
157157
end
158158
end
159+
160+
# Returns the noask file text for Solaris hosts
161+
#
162+
# @raise [ArgumentError] If called on a host with a platform that's not Solaris
163+
#
164+
# @return [String] the text of the noask file
165+
def noask_file_text
166+
if variant == 'solaris' && version == '10'
167+
<<~NOASK
168+
# Write the noask file to a temporary directory
169+
# please see man -s 4 admin for details about this file:
170+
# http://www.opensolarisforum.org/man/man4/admin.html
171+
#
172+
# The key thing we don't want to prompt for are conflicting files.
173+
# The other nocheck settings are mostly defensive to prevent prompts
174+
# We _do_ want to check for available free space and abort if there is
175+
# not enough
176+
mail=
177+
# Overwrite already installed instances
178+
instance=overwrite
179+
# Do not bother checking for partially installed packages
180+
partial=nocheck
181+
# Do not bother checking the runlevel
182+
runlevel=nocheck
183+
# Do not bother checking package dependencies (We take care of this)
184+
idepend=nocheck
185+
rdepend=nocheck
186+
# DO check for available free space and abort if there isn't enough
187+
space=quit
188+
# Do not check for setuid files.
189+
setuid=nocheck
190+
# Do not check if files conflict with other packages
191+
conflict=nocheck
192+
# We have no action scripts. Do not check for them.
193+
action=nocheck
194+
# Install to the default base directory.
195+
basedir=default
196+
NOASK
197+
else
198+
msg = "noask file text unknown for platform '#{self}'"
199+
raise ArgumentError, msg
200+
end
201+
end
159202
end
160203
end

0 commit comments

Comments
 (0)