Hi Aaron, I've committed a new version of OSX.pm to the repository. It includes the following
enable_firewall_port() - new get_cpu_core_count() - new check_connection_on_port() - new user_exists() - new set_vcld_post_load_status() - fix It includes all the formatting from Andy (I removed the <CR> stuff, too) I also switched the run_ssh_command() call for the $self->execute() call. It makes the code easier to read. If I missed anything please let me know. __Jim On 5/17/2012 6:03 PM, Aaron Peeler wrote: > Hi Jim, > > I have another routine to add to OSX.pm. user_exists. It was mainly > needed for the server reservations. > > It's using the id cmd, so it shouldn't need any changes. But since it > wouldn't work for windows, I couldn't put it in the OS.pm module. > > > =head2 user_exists > > Parameters : > Returns : > Description : > > =cut > > sub user_exists { > my $self = shift; > if (ref($self) !~ /linux/i) { > notify($ERRORS{'CRITICAL'}, 0, "subroutine was called > as a function, it must be called as a class method"); > return; > } > > my $management_node_keys = $self->data->get_management_node_keys(); > my $computer_node_name = $self->data->get_computer_node_name(); > # Attempt to get the username from the arguments > # If no argument was supplied, use the user specified in the > DataStructure > my $username = shift; > if (!$username) { > $username = $self->data->get_user_login_id(); > } > > notify($ERRORS{'DEBUG'}, 0, "checking if user $username exists on > $computer_node_name"); > > # Attempt to query the user account > my $query_user_command = "id $username"; > my ($query_user_exit_status, $query_user_output) = > $self->execute($query_user_command,1); > if (grep(/uid/, @$query_user_output)) { > notify($ERRORS{'DEBUG'}, 0, "user $username exists on > $computer_node_name"); > return 1; > } > elsif (grep(/No such user/i, @$query_user_output)) { > notify($ERRORS{'DEBUG'}, 0, "user $username does not exist on > $computer_node_name"); > return 0; > } > elsif (defined($query_user_exit_status)) { > > notify($ERRORS{'WARNING'}, 0, "failed to determine if > user $username exists on $computer_node_name, exit status: > $query_user_exit_status, output:\n@{$query_user_output}"); > return; > } > else { > notify($ERRORS{'WARNING'}, 0, "failed to run ssh > command to determine if user $username exists on > $computer_node_name"); > return; > } > > } > > > > > > On Thu, May 17, 2012 at 5:26 PM, James O'Dell <jod...@fullerton.edu> wrote: > Andy, > > The 'currentimage.txt' line you were referring to was originally one > line, and it was commented out. > > Chances are, the reason the 'currentimage.txt' line looks weird > is probably due to you looking at it from a windows system. > > The original code has the line commented out. The line contains > a 'ctrl-M', which windows is interpreting as a carriage return. > So windows breaks the one line into 2 lines at the carriage return > (aka ctrl-M). > > i.e. > Original Linux > >>> # # remove carriage returns > >>> # $command .= " && sed -i '' -e \'s/^M//g\' currentimage.txt"; > > Window's > >>> # # remove carriage returns > >>> # $command .= " && sed -i '' -e \'s/ > >>> //g\' currentimage.txt"; > > > I'm thinking the whole mess should be removed to avoid any problems. > > I'm sure you already know this, but Windows and Linux text files > terminate lines differently.. > > Windows = <CR>+<LF> > Linux/MAC OSX = <LF> > > Hope this helps, > > __Jim > > On 5/17/2012 7:06 AM, Andy Kurth wrote: > >>> Hi Jim, > >>> I made a commit to OSX.pm this morning. I mainly changed the > >>> indentation. For the most part, the Perl code is indented using tabs. > >>> > >>> I also made some minor indentation/spacing changes to the pod sections > >>> so that the output lined up when running pod2text, etc. These > >>> sections must be indented using spaces. > >>> > >>> None of the code functionality should have changed except for possibly > >>> one location. My editor was complaining about lines 1843/1844 in the > >>> previous revision: > >>> 1843: # $command .= " && sed -i '' -e \'s/ > >>> 1844: //g\' currentimage.txt"; > >>> > >>> I'm assuming both of these lines should be commented. I changed > it to: > >>> 1783: # $command .= " && sed -i '' -e \'s///g\' > currentimage.txt"; > >>> > >>> Please do an 'svn up' and make sure I didn't mess anything up. > >>> > >>> Thanks, > >>> Andy > >>> > >>> On Wed, Apr 4, 2012 at 3:10 PM, Aaron Peeler > <aaron_pee...@ncsu.edu> wrote: > >>>> Hi Jim, > >>>> > >>>> Made progress to a point, I wasn't able to get a full blown instance > >>>> going, but I feel my effort was good enough to prove it can be done > >>>> and used. Overall the code looks good and as we move forward, > possibly > >>>> in the 2.4 release, I think it would be ideal to put all OS related > >>>> routines in their respective OS modules, like > >>>> notify_via_(wall,msg,oascript), etc. > >>>> > >>>> In the supporting documentation for this on the vcl wiki somewhere, I > >>>> recommend to list known working apple hardware. So far I can say that > >>>> it would work with the Mac Mini 2011 model and your running it on > >>>> MacPro. > >>>> > >>>> I'll work on committing the backend and db components it into > trunk on > >>>> your behalf. I think Josh has already committed the php part. > >>>> > >>>> Thanks for the work and sorry it took so long to review it. > >>>> > >>>> Aaron > >>>> > >>>> > >>>> On Wed, Apr 4, 2012 at 7:49 AM, Aaron Peeler > <aaron_pee...@ncsu.edu> wrote: > >>>>> Thanks Jim. > >>>>> > >>>>> Right, I saw that one also. I've got a 2010 mac mini model which > also > >>>>> has the keyboard issue. Doesn't seem like it's feasible to use the > >>>>> 2010 model. Going to give it one more shot with trying to do a > >>>>> kickstart install off the dvd. It that doesn't work then I'll try to > >>>>> locate a 2011 model. > >>>>> > >>>>> Overall your code looks good and should work - just would like > to test it. > >>>>> > >>>>> Aaron > >>>>> > >>>>> > >>>>> On Tue, Apr 3, 2012 at 4:35 PM, James O'Dell > <jod...@fullerton.edu> wrote: > >>> This site gives a walk through installing OSX on a mac mini > >>> using esxi 5. It lists the hardware used, and a link to > >>> vmware's nic driver. > >>> > >>>>>>>> > http://paraguin.com/2012/01/17/os-x-on-a-mac-mini-with-vmware-esxi-5/ > >>> > >>> __Jim > >>> > >>> On 4/3/2012 11:48 AM, Aaron Peeler wrote: > >>>>>>>> Hi Daiyu, > >>>>>>>> > >>>>>>>> Thanks. Yes those are a couple that I had found. > >>>>>>>> > >>>>>>>> Aaron > >>>>>>>> > >>>>>>>> On Tue, Apr 3, 2012 at 2:35 PM, Hayashi, Daiyu > >>>>>>>> <dhaya...@exchange.fullerton.edu> wrote: > >>>>>>>>> Based on your email I take it that you've read these posts. > >>>>>>>>> > >>>>>>>>> > http://paraguin.com/2012/01/10/the-mac-mini-vmware-esxi-5-server-part-1-research/ > >>>>>>>>> > >>>>>>>>> > http://tinkertry.com/maczilla-core-i5-mac-mini-esxi-5-0-update-1/ > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> Daiyu Hayashi > >>>>>>>>> Lead Information Technology Consultant > >>>>>>>>> Mihaylo College of Business and Economics > >>>>>>>>> Cal State University Fullerton > >>>>>>>>> 657-278-7347 > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> -----Original Message----- > >>>>>>>>> From: Aaron Peeler [mailto:fapee...@ncsu.edu] > >>>>>>>>> Sent: Tuesday, April 03, 2012 6:28 AM > >>>>>>>>> To: vcl-dev@incubator.apache.org > >>>>>>>>> Subject: VCL-543 OSX under ESXi 4.1 > >>>>>>>>> > >>>>>>>>> Jim, > >>>>>>>>> > >>>>>>>>> I'm working on testing the OSX module for inclusion in the > next release and run into some questions. > >>>>>>>>> > >>>>>>>>> By chance have you tried to use other apple hardware? I've > got a mac mini (2010 mid) model. > >>>>>>>>> > >>>>>>>>> The initial issue I've run into is the usb keyboard gets > disabled once the vmware kernel is loaded. In searching on a solution > for this, I've run across folks stating that there is a missing > network adapter as well and that has to added later. > >>>>>>>>> > >>>>>>>>> I'm going to attempt to install ESXi on a usb drive and boot > the mac mini off of that (hopefully). > >>>>>>>>> > >>>>>>>>> So I was wondering if you've installed ESXi (either 4.1 or 5 > ) on a mac mini yet? > >>>>>>>>> > >>>>>>>>> Thanks, > >>>>>>>>> Aaron > >>>>>>>>> > >>>>>>>>> -- > >>>>>>>>> Aaron Peeler > >>>>>>>>> Program Manager > >>>>>>>>> Virtual Computing Lab > >>>>>>>>> NC State University > >>>>>>>>> > >>>>>>>>> All electronic mail messages in connection with State > business which are sent to or received by this account are subject to > the NC Public Records Law and may be disclosed to third parties. > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>> > >>> > >>>>> > >>>>> > >>>>> > >>>>> -- > >>>>> Aaron Peeler > >>>>> Program Manager > >>>>> Virtual Computing Lab > >>>>> NC State University > >>>>> > >>>>> All electronic mail messages in connection with State business which > >>>>> are sent to or received by this account are subject to the NC Public > >>>>> Records Law and may be disclosed to third parties. > >>>> > >>>> > >>>> > >>>> -- > >>>> Aaron Peeler > >>>> Program Manager > >>>> Virtual Computing Lab > >>>> NC State University > >>>> > >>>> All electronic mail messages in connection with State business which > >>>> are sent to or received by this account are subject to the NC Public > >>>> Records Law and may be disclosed to third parties. > > > > -- Jim O'Dell Network Analyst California State University Fullerton Email: jod...@fullerton.edu Phone: (657) 278-2256