lib/puppet/provider/tpm_ownership/trousers.rb
# Generate the arguments required to interact with tpm_takeownership.
#
# @return [Array,String] The first item returned will be an array of arrays,
#   representing an Expect interaction. Each subarray first contains a regex
#   of what to expect, and next contains the text to be typed in. The second
#   item being returned is the command that will be interacted with, with
#   proper arguments as decided by this function.
Generate the arguments required to interact with tpm_takeownership.
Generate the arguments required to interact with tpm_takeownership .
def generate_args
    stdin      = []
    cmd        = ['tpm_takeownership']
    owner_pass = resource[:owner_pass]
    srk_pass   = resource[:srk_pass]
    if owner_pass != 'well-known'
      stdin << [ /owner password/i,   owner_pass ]
      stdin << [ /Confirm password/i, owner_pass ]
    else
      cmd << '-y'
    end
    if srk_pass != 'well-known'
      stdin << [ /SRK password/i,     srk_pass   ]
      stdin << [ /Confirm password/i, srk_pass   ]
    else
      cmd << '-z'
    end
    return stdin, cmd.join(' ')
  end
def generate_args stdin = [ ] cmd = [ 'tpm_takeownership' ] owner_pass = resource [ :owner_pass ] srk_pass = resource [ :srk_pass ] if owner_pass != 'well-known' stdin << [ / owner password /i , owner_pass ] stdin << [ / Confirm password /i , owner_pass ] else cmd << '-y' end if srk_pass != 'well-known' stdin << [ / SRK password /i , srk_pass ] stdin << [ / Confirm password /i , srk_pass ] else cmd << '-z' end return stdin , cmd . join ( ' ' ) end
Generate the arguments required to interact with tpm_takeownership.
Generate the arguments required to interact with tpm_takeownership .
The first item returned will be an array of arrays, representing an Expect interaction. Each subarray first contains a regex of what to expect, and next contains the text to be typed in. The second item being returned is the command that will be interacted with, with proper arguments as decided by this function.
The first item returned will be an array of arrays representing an Expect interaction . Each subarray first contains a regex of what to expect and next contains the text to be typed in . The second item being returned is the command that will be interacted with with proper arguments as decided by this function .
Array,String