Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

VAGRANT: Using Basic 1212 Script - Exec user rights #1

Closed
matthewbaldwin opened this issue Oct 10, 2013 · 15 comments
Closed

VAGRANT: Using Basic 1212 Script - Exec user rights #1

matthewbaldwin opened this issue Oct 10, 2013 · 15 comments

Comments

@matthewbaldwin
Copy link

testbox---oracle-vagrantoel64--oracle-product-middleware12c-user_projects-domains-wls12c---ssh--
I have a basic vagrant oel64.box that I created.

https://dl.dropboxusercontent.com/u/97268835/boxes/oel64.box

The script runs fine until it moves to pack and start the domain. It then starts encountering errors. You can see clearer in the attatched image with the --debug flag turned in the Vagrantfile. I then went down the path to modify the exec commands to "oracle" and "dba" to see if this would give me the correct rights when executing the command.

exec { "domain.py ${domain} ${title}":
command => "rm -I ${path}/domain_${domain}.py",
require => Exec["execwlst ${domain} ${title}"],
user => 'oracle', # Added by MB
group => 'dba', # Added by MB
logoutput => true,
}

The failed execution of this line is the first redline in the image.

Any thoughts as to how to make exec and wlstexec behave as oracle/dba?

Thanks.

testbox---oracle-vagrantoel64--oracle-product-middleware12c-user_projects-domains-wls12c---ssh--

Debug: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[execwlst Wls12c wlsDomain12c]: The container Wls::Wlsdomain[wlsDomain12c] will propagate my refresh event
Debug: Finishing transaction 70122193623280
Info: FileBucket adding {md5}38672f152083862d8913e59feefa861a
Info: /File[nodemanager.properties ux 1212 wlsDomain12c]: Filebucketed /oracle/product/Middleware12c/user_projects/domains/Wls12c/nodemanager/nodemanager.properties to puppet with sum 38672f152083862d8913e59feefa861a
Notice: /File[nodemanager.properties ux 1212 wlsDomain12c]/content: content changed '{md5}38672f152083862d8913e59feefa861a' to '{md5}1e9bb4aeecbee9d27e9973fe9204a528'
Notice: /File[nodemanager.properties ux 1212 wlsDomain12c]/mode: mode changed '0640' to '0775'
Notice: /File[nodemanager.properties ux 1212 wlsDomain12c]/seluser: seluser changed 'unconfined_u' to 'system_u'
Debug: /File[nodemanager.properties ux 1212 wlsDomain12c]: The container Wls::Wlsdomain[wlsDomain12c] will propagate my refresh event
Debug: /File[nodemanager.properties ux 1212 wlsDomain12c]: The container Wls::Wlsdomain[wlsDomain12c] will propagate my refresh event
Debug: /File[nodemanager.properties ux 1212 wlsDomain12c]: The container Wls::Wlsdomain[wlsDomain12c] will propagate my refresh event
Debug: Execdomain.py Wls12c wlsDomain12c: Executing 'rm -I /data/install/domain_Wls12c.py'
Debug: Executing 'rm -I /data/install/domain_Wls12c.py'
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[domain.py Wls12c wlsDomain12c]/returns: rm: cannot remove `/data/install/domain_Wls12c.py': Permission denied
Error: rm -I /data/install/domain_Wls12c.py returned 1 instead of one of [0]
Error: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[domain.py Wls12c wlsDomain12c]/returns: change from notrun to 0 failed: rm -I /data/install/domain_Wls12c.py returned 1 instead of one of [0]
Debug: ExecsetDebugFlagOnFalse Wls12c wlsDomain12c: Executing check '/bin/grep debugFlag="true" /oracle/product/Middleware12c/user_projects/domains/Wls12c/bin/setDomainEnv.sh | /usr/bin/wc -l'
Debug: Executing '/bin/grep debugFlag="true" /oracle/product/Middleware12c/user_projects/domains/Wls12c/bin/setDomainEnv.sh | /usr/bin/wc -l'
Debug: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[setDebugFlagOnFalse Wls12c wlsDomain12c]/onlyif: 0
Debug: ExecsetDebugFlagOnFalse Wls12c wlsDomain12c: Executing 'sed -i -e's/debugFlag="true"/debugFlag="false"/g' /oracle/product/Middleware12c/user_projects/domains/Wls12c/bin/setDomainEnv.sh'
Debug: Executing 'sed -i -e's/debugFlag="true"/debugFlag="false"/g' /oracle/product/Middleware12c/user_projects/domains/Wls12c/bin/setDomainEnv.sh'
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[setDebugFlagOnFalse Wls12c wlsDomain12c]/returns: executed successfully
Debug: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[setDebugFlagOnFalse Wls12c wlsDomain12c]: The container Wls::Wlsdomain[wlsDomain12c] will propagate my refresh event
Debug: Execpack domain Wls12c wlsDomain12c: Executing '/oracle/product/Middleware12c/wlserver/common/bin/pack.sh -domain=/oracle/product/Middleware12c/user_projects/domains/Wls12c -template=/data/install/domain_Wls12c.jar -template_name=domain_Wls12c -log=/data/install/domain_Wls12c.log -log_priority=INFO'
Debug: Executing '/oracle/product/Middleware12c/wlserver/common/bin/pack.sh -domain=/oracle/product/Middleware12c/user_projects/domains/Wls12c -template=/data/install/domain_Wls12c.jar -template_name=domain_Wls12c -log=/data/install/domain_Wls12c.log -log_priority=INFO'
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: WARNING - Unable to create log file </data/install/domain_Wls12c.log>: java.io.IOException: Permission denied
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: Oct 10, 2013 1:04:58 AM [THREAD: runScript] com.oracle.cie.domain.script.ScriptExecutor output
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: INFO: read domain from "/oracle/product/Middleware12c/user_projects/domains/Wls12c"
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: << read domain from "/oracle/product/Middleware12c/user_projects/domains/Wls12c"
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: Oct 10, 2013 1:05:13 AM [THREAD: runScript] com.oracle.cie.domain.script.ScriptExecutor output
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: INFO: succeed: read domain from "/oracle/product/Middleware12c/user_projects/domains/Wls12c"
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: >> succeed: read domain from "/oracle/product/Middleware12c/user_projects/domains/Wls12c"
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: Oct 10, 2013 1:05:13 AM [THREAD: runScript] com.oracle.cie.domain.script.ScriptExecutor output
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: INFO: write template to "/data/install/domain_Wls12c.jar"
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: << write template to "/data/install/domain_Wls12c.jar"
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: Oct 10, 2013 1:05:14 AM [THREAD: Thread-2] com.oracle.cie.domain.TemplateGenerator run
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: SEVERE: Template Creation Failed!
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns:
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: Template Location: /data/install/domain_Wls12c.jar
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns:
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns: Reason: /data/install/domain_Wls12c.jar (Permission denied)
Notice: /Stage[main]/Wls12c_domain/Wls::Wlsdomain[wlsDomain12c]/Exec[pack domain Wls12c wlsDomain12c]/returns:

@biemond
Copy link
Owner

biemond commented Oct 10, 2013

Hi,

did you use the latest jdk7 module because this one sets the download dir to 775 and user root and the wls modules uses this folder also. so can you use the latest jdk7 module or a different download dir for the jdk7 module.

thanks

@matthewbaldwin
Copy link
Author

I used the latest JDK7 in puppetforge. Sounds like I should use the one from git.

This is the bruteforce method I have been using as I learn.

I installed:

Downloads needed:

  • jdk-7u40-linux-x64.gz # note that the file needs to be modified to be jdk-7u40-linux-x64.tar.gz
  • WLS 1212 is either delivered as wls_121200.jar from OTN or as V38158-01.zip from eSource (http://esource.oracle.com) which then uncompresses to wls_121200.jar. It is not in the OFM format as shown in the script...something I just didn't have time to futz with.

HostMachine:

Install vagrant

vagrant box list

  • should be blank

vagrant box add oel64

make directory structure

mkdir testbox

vagrant init

modify Vagrantfile to look like:
https://github.com/matthewbaldwin/testbox/blob/master/Vagrantfile

Make directory structure:

  • These will be shared on the guest box as /vagrant/puppet/.. as well as /etc/puppet/manifests and /etc/puppet/modules-0

testbox/puppet/manifests
testbox/puppet/modules

vagrant up

vagrant ssh (ssh into guest where puppet is installed)

#Puppet 3 already installed - these could be automated. The install dir is shared with the host
puppet install module -i /vagrant/puppet/modules biemond/jdk7
puppet install module -i /vagrant/puppet/modules biemond/wls
puppet install module -i /vagrant/puppet/modules biemond/orautils
puppet install module -i /vagrant/puppet/modules fiddyspence/sysctl
puppet install module -i /vagrant/puppetmodules erwbgy/limits

exit guest

create site.pp in ( https://github.com/matthewbaldwin/testbox/blob/master/puppet/manifests/site.pp) in the testbox/puppet/manifest directory. (note I commented out the wlHome attribute and modified yours for jdk 1.7 40.

Oracle Big Files Management (it aint pretty)

copy modified jdk to jdk7 module files directory

create a files and a wls directory
/testbox/puppet/modules/wls/files/wls

and place the wls 1212 jar file there..I also made a file with the ofm naming convention (ofm_wls_generic_12.1.2.0.0_disk1_1of1.zip) in the files directory tomake the script happy.

vagrant provision

(if all goes well...you should see the jdk install and then complete the wls install and create a domain via wlst.) It then fails on pack...

vagrant ssh

su -l oracle
password oracle

cd /oracle/product/Middleware12c/user_projects/domains/Wls12c
./startWeblogic.sh

hth...

@biemond
Copy link
Owner

biemond commented Oct 10, 2013

Indeed,

github is always the last version, I try to combine issues to a forge release. else too many releases.

when you add your own details to the param.pp of the orutils then you will get all the scripts in /opt/scripts/wls
also autostart nodemanager and clean environment script.

you got everything working now

thanks Edwin

@matthewbaldwin
Copy link
Author

Edwin...I figured that git was the place to go... ;-) I appreciate the help and will give it a try...once I am done...yes...I will take the mess I wrote up there and put it into something a little more formal.

@matthewbaldwin
Copy link
Author

Ok..I refreshed jdk7, wls and orautils from git and everything worked except starting the AdminServer from node manager. I found the issue in the following file.

https://github.com/biemond/biemond-wls/blob/master/templates/wlst/startWlsServer2.py.erb

It was expecting "sys.argv[1]"....and that was not correct. So I changed to "welcome1" tested and all ran ok. Very happy!

This should be <%= password =%> correct? Which is fed in from the site.pp,

@biemond
Copy link
Owner

biemond commented Oct 10, 2013

Hi,

First do you want to make a blog about this cause maybe people want to do this with vagrant. ( including me )

Then your problem.

I don't want add passwords in my scripts and also want to store this script on the server ( cause else I need to remove it everytime ) so I pass it on as 1st parameter after wlst.sh command and the scriptname

but I think the parameter should be sys.argv[0] instead of sys.argv[1]

  command     => "${javaCommand} ${path}/${title}${script} ${password}",

Just to check it did you use the password parameter in wlscontrol

  # start AdminServers for configuration
  wls::wlscontrol{'startWLSAdminServer12c':
  wlsDomain     => $wlsDomainName,
  wlsDomainPath => "${osMdwHome}/user_projects/domains/${wlsDomainName}",
  wlsServer     => "AdminServer",
  action        => 'start',
  wlHome        => $osWlHome,
  fullJDKName   => $jdkWls12gJDK,  
  wlsUser       => "weblogic",
  password      => "weblogic1", <--------------------
  address       => $address,
  port          => $nodemanagerPort,
  user          => $user,
  group         => $group,
  downloadDir   => $downloadDir,
  logOutput     => true, 
  require       => Wls::Nodemanager['nodemanager12c'],
 }

Thanks

@matthewbaldwin
Copy link
Author

I agree with the script system arg would be 0 not 1.

When I started AdminServer by hand via WLST and nmConnect...the password was 'welcome1' when I connected...I am testing with <%= password %> now, so yes. I defined 'welcome1' in the wlscontrol def as you mentioned above.

I will try with sys.argv[0] after that...it is easy to teardown and restart now. ;-)

@biemond
Copy link
Owner

biemond commented Oct 10, 2013

I am also doing some checks with some outputs cause somehow it works perfectly for me.

@biemond
Copy link
Owner

biemond commented Oct 10, 2013

Arg1 is the good one, arg0 is the script name

I added this output to the script

python script wls:wlscontrol

 wlsUser    = '<%= @wlsUser %>' 
 password   = sys.argv[1] 
 machine    = '<%= @address %>'
 portNumber = '<%= @port %>'

 domain     = '<%= @wlsDomain %>'
 domainPath = '<%= @wlsDomainPath %>'
 wlsServer  = '<%= @wlsServer %>'

 print "arg0: ", sys.argv[0]
 print "arg1: ", sys.argv[1]

and got this output

Wls::Wlscontrol[startOSBSOAAdminServer]/Exec[execwlst startOSBSOAAdminServerstartWlsServer2.py ]/returns: arg0: /data/install/startOSBSOAAdminServerstartWlsServer2.py

Wls::Wlscontrol[startOSBSOAAdminServer]/Exec[execwlst startOSBSOAAdminServerstartWlsServer2.py ]/returns: arg1: weblogic1

@matthewbaldwin
Copy link
Author

I tried <%= password %> and sys.argv[0] both failed to connect to the nodemanager.

Error:

WLSTException: Error occurred while performing nmConnect : Cannot connect to Node Manager. : Received error message from Node Manager Server: [Access to domain 'Wls12c' for user 'weblogic' denied]. Please check Node Manager log for details.

[vagrant@vagrantoel64 install]$ cat startWLSAdminServer12cstartWlsServer2.py

# python script wls:wlscontrol

wlsUser    = 'weblogic'
# password   = sys.argv[1] 
# foo        =  sys.argv[1]
password   =  sys.argv[0]
# password   = 'welcome1'
machine    = 'localhost'
portNumber = '5556'

domain     = 'Wls12c'
domainPath = '/oracle/product/Middleware12c/user_projects/domains/Wls12c'
wlsServer  = 'AdminServer'

nmConnect(wlsUser,password,machine,portNumber,domain,domainPath,'ssl')

#start the WlsServer
nmStart(wlsServer)

#Ask the status of the WlsServer
nmServerStatus(wlsServer)

#disconnect from the nodemanager
nmDisconnect()
# start AdminServers for configuration
  wls::wlscontrol{'startWLSAdminServer12c':
      wlsDomain     => $wlsDomainName,
      wlsDomainPath => "${osMdwHome}/user_projects/domains/${wlsDomainName}",
      wlsServer     => "AdminServer",
      action        => 'start',
      wlHome        => $osWlHome,
      fullJDKName   => $jdkWls12gJDK,  
      wlsUser       => "weblogic",
      password      => "welcome1"
      address       => $address,
      port          => $nodemanagerPort,
      user          => $user,
      group         => $group,
      downloadDir   => $downloadDir,
      logOutput     => true, 
      require       => Wls::Nodemanager['nodemanager12c'],
  }

@biemond
Copy link
Owner

biemond commented Oct 10, 2013

Hi,

can you add a ',' after the " in the wls::wlscontrol{'startWLSAdminServer12c': statement

  password      => "welcome1",  <------

can you use sys.argv[1] again and add a print statement for arg0 & arg1

 print "arg0: ", sys.argv[0]
 print "arg1: ", sys.argv[1]

@matthewbaldwin
Copy link
Author

You are correct... sys.argv[1] is the correct password and it ran cleanly.

I think your eyesight is better then mine. It would have taken a lifetime to see that comma.

Just so you know, I added a "files" directory to wls module and then added another directory called wls.

Therefore:

/Users/myname/vagrant_work/testbox/puppet/modules/wls/files/wls on the host translates to /vagrant/puppet/modules/wls/files/wls on the guest.

The issue that I had was that this structure is on host and shared with the guest. The user vagrant does not have rights to create a directory on the host machine so it fails.

The answer is to place a dummy ofm .zip file in the wls/files directory and then put the WLS1212 jar in

/modules/wls/files/wls directory

After that...all is right with the world.

As for the blog...I plan on doing that. I am going to be interested in standing up just an oracle db in the same box...I am very incremental. :-)

I am documenting a Windows Host install now for my mainly Windows based colleagues.

@biemond
Copy link
Owner

biemond commented Oct 10, 2013

great to hear this

very excited to read your blog and try it myself. I didnot recently test a windows deployment, windows is crazy with right and permission plus the space char in program files

did you try this as mountpoint
$puppetDownloadMntPoint => "/mnt"

and not using puppet:///modules/wls/" (default) or "puppet:///middleware/" ,this is the puppet file server share

ciao

@matthewbaldwin
Copy link
Author

I am not going to support a deployment of WLS to windows...that is more then my patience can muster. I am just going to be using Windows as the host and then spinning up an OEL64 instance.

FYI..Total time to deploy and have admin server running is shy of 10 minutes. I really like having the nm running as well with ssl...that was a huge bonus.

I can try the /mnt next run.

@matthewbaldwin
Copy link
Author

Please review http://vbatik.wordpress.com for final outcome. This works very well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants