• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Postinitscripts and storage node replications

Scheduled Pinned Locked Moved Solved
FOG Problems
2
13
1.6k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    JGallo
    last edited by JGallo Sep 12, 2017, 4:00 PM Sep 12, 2017, 9:56 PM

    Server
    • FOG Version: 1.5.0 RC9
    • OS:
    Client
    • Service Version:
    • OS:
    Description

    So I went ahead and made the jump to 1.5.0 RC-9 this morning and ran into a couple weird things. First I decided to start from scratch and do a fresh install. Once I setup everything, I went ahead and placed my files for the postinitscripts and went ahead and tried to register a computer. Upon it loading the postinitscript, it detected some error. Stated that it was unable to register host /bin/fog.man.reg and below it had Args Passed:

    0_1505253023804_image_uploaded_from_ios_720.jpg

    So upon several attempts to fix this, I changed the fog.postinit file back to it’s original state. Had to setup the storage nodes and location plug in. Once I did all that, I noticed that replication wasn’t working in RC9. Noticed someone mentioned that in a different post. So eventually read the part to go back to RC7 which I did and replication is definitely working.

    At this point I went ahead and tried to the postinitscripts on RC7 and they work fine. So my observation is the postinitscripts work in RC7 but not in RC9 and possibly in RC8. Any one else having similar issues?

    1 Reply Last reply Reply Quote 0
    • T
      Tom Elliott
      last edited by Sep 13, 2017, 5:27 AM

      Only thing I can think is it’s your postinit script. There was a change I how web calls are handled in rc9 that I suspect your postinit isn’t using. I’m going on a limb and saying your postinit just copies a new file over dealing with registration? Can you post it here. I don’t think this is a bug in fog, rather your script not updated to use the new methods.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      J 1 Reply Last reply Sep 13, 2017, 3:02 PM Reply Quote 0
      • T
        Tom Elliott
        last edited by Sep 13, 2017, 5:29 AM

        For this reason I’ve moved this posting to fog problems. I really don’t think it’s a bug fog is causing, just a new method of handling that your modified scripts need to adjust for.

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • J
          JGallo @Tom Elliott
          last edited by JGallo Sep 13, 2017, 9:15 AM Sep 13, 2017, 3:02 PM

          @tom-elliott

          Cool. Yes my postinitscript just copies a modified version of fog.man.reg I wasn’t sure so I assumed it could be a bug. Basically I just remove questions I don’t need to answer to make the registration process quicker for the techs. Not sure if all of it will show up because it had issues before trying to post the code. Basically it’s a copy of the fog.man.reg modified to have less questions.

          Which script did you want to see, the modified fog.man.reg or the fog.postinit script? Should I use the same method as before but get a new copy of fog.man.reg from RC9?

          T 1 Reply Last reply Sep 13, 2017, 3:31 PM Reply Quote 0
          • T
            Tom Elliott @JGallo
            last edited by Sep 13, 2017, 3:31 PM

            @jgallo Modified fog.man.reg yes please.

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            J 3 Replies Last reply Sep 13, 2017, 3:36 PM Reply Quote 0
            • J
              JGallo @Tom Elliott
              last edited by Sep 13, 2017, 3:36 PM

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • J
                JGallo @Tom Elliott
                last edited by Sep 13, 2017, 3:40 PM

                @tom-elliott

                #!/bin/bash
                . /usr/share/fog/lib/funcs.sh
                . /bin/fog.donate
                clearScreen
                displayBanner
                disks=""
                disk=""
                hd=""
                getHardDisk
                sysman=""
                sysman64=""
                sysproduct=""
                sysproduct64=""
                sysversion=""
                sysversion64=""
                sysserial=""
                systype=""
                biosversion=""
                biosvendor=""
                biosdate=""
                mbman=""
                mbproductname=""
                mbversion=""
                mbserial=""
                mbasset=""
                cpuman=""
                cpuversion=""
                cpucurrent=""
                cpumax=""
                mem=""
                hdinfo=""
                caseman=""
                casever=""
                caseserial=""
                casesasset=""
                sysserial64=""
                systype64=""
                biosversion64=""
                biosvendor64=""
                biosdate64=""
                mbman64=""
                mbproductname64=""
                mbversion64=""
                mbserial64=""
                mbasset64=""
                cpuman64=""
                cpuversion64=""
                cpucurrent64=""
                cpumax64=""
                mem64=""
                hdinfo64=""
                caseman64=""
                casever64=""
                caseserial64=""
                casesasset64=""
                dots "Using disk device"
                echo $hd
                echo " * Starting host registration"
                mac=$(getMACAddresses | base64)
                exists=$(curl -ks --data "mac=$mac" http://${web}service/man.hostexists.php 2>/dev/null)
                checkAndSet() {
                    local testvar="$1"
                    local onlynum="$2"
                    [[ -z $testvar ]] && return
                    if [[ $onlynum =~ [Tt][Rr][Uu][Ee] && $testvar =~ ^[0-9]+$ ]]; then
                        echo $testvar | base64
                    elif [[ $testvar =~ ^[0-9,]+$ ]]; then
                        echo $testvar | base64
                    else
                        return
                    fi
                }
                setIDs() {
                    local varVar="$1"
                    local str="$2"
                    local csvstyle="$3"
                    local dummy="$4"
                    local max="$5"
                    local res=""
                    local url=""
                    local oIFS=$IFS
                    local line=""
                    while [[ -z ${!varVar} ]]; do
                        [[ $csvstyle =~ [Tt][Rr][Uu][Ee] ]] && echo -n "    Enter the $str IDs separated with , to associate with computer (? for listing): " || echo -n "    Enter the $str ID to associate with computer (? for listing): "
                        read dummy
                        dummy=$(echo $dummy | sed -e 's/^,//' -e 's/,$//')
                        case $dummy in
                            [?])
                                url="http://${web}service/${str}listing.php"
                                clearScreen
                                res=$(echo -e $(curl -ks $url 2>/dev/null))
                                i=0
                                IFS=$'\n'
                                for line in $res; do
                                    let i+=1
                                    echo $line
                                    if [[ $i -eq $max ]]; then
                                        [[ $csvstyle =~ [Tt][Rr][Uu][Ee] ]] && echo -n "    Press [Enter] to proceed or enter the $str IDs separated with , to associate with computer: " || echo -n "    Press [Enter] to proceed or enter the $str ID to associate with computer: "
                                        read dummy
                                        case $dummy in
                
                J 1 Reply Last reply Sep 13, 2017, 3:41 PM Reply Quote 0
                • J
                  JGallo @JGallo
                  last edited by Sep 13, 2017, 3:41 PM

                  @jgallo

                   [?]|"")
                                                  i=0
                                                  clearScreen
                                                  continue
                                                  ;;
                                          esac
                                          case $csvstyle in
                                              [Tt][Rr][Uu][Ee])
                                                  [[ $dummy =~ ^[0-9,]+$ ]] && printf -v "$varVar" $(checkAndSet $dummy) || setIDs "$varVar" "$str" "$csvstyle" "$dummy" "$max"
                                                  break
                                                  ;;
                                              *)
                                                  [[ $dummy =~ ^[0-9]+$ ]] && printf -v "$varVar" $(checkAndSet $dummy "true") || setIDs "$varVar" "$str" "$csvstyle" "$dummy" "$max"
                                                  break
                                                  ;;
                                          esac
                                          i=0
                                          dummy=$(echo $dummy | sed -e 's/^,//' -e 's/,$//')
                                          clearScreen
                                      fi
                                  done
                                  ;;
                              ""|0)
                                  printf -v "$varVar" 0
                                  ;;
                              *)
                                  dummy=$(echo $dummy | sed -e 's/^,//' -e 's/,$//')
                                  [[ -z $dummy ]] && setIDs "$varVar" "$str" "$csvstyle" "$dummy" "$max"
                                  case $csvstyle in
                                      [Tt][Rr][Uu][Ee])
                                          [[ $dummy =~ ^[0-9,]+$ ]] && printf -v "$varVar" $(checkAndSet $dummy) || setIDs "$varVar" "$str" "$csvstyle" "$dummy" "$max"
                                          ;;
                                      *)
                                          [[ $dummy =~ ^[0-9]+$ ]] && printf -v "$varVar" $(checkAndSet $dummy "true") || setIDs "$varVar" "$str" "$csvstyle" "$dummy" "$max"
                                          ;;
                                  esac
                                  ;;
                          esac
                      done
                      IFS=$oIFS
                  }
                  [[ $exists != "#!ok" ]] && handleError "Unable to register host: $exists ($0)\n   Args Passed: $*"
                  host=""
                  imageid=""
                  blImage=""
                  keyEnter=""
                  res=""
                  while [[ $res != "#!ok" ]]; do
                      echo -n " * Enter hostname for this computer: "
                      read host
                      if [[ ${#host} -gt 15 ]]; then
                          host=${host:0:15}
                          echo " | Truncated to 15 characters: $host"
                          usleep 2000000
                      fi
                      host=$(echo $host | base64)
                      res=$(curl -ks --data "host=$host" http://${web}service/hostnameloop.php 2>/dev/null)
                      [[ $res != "#!ok" ]] && echo "$res"
                  done
                  imageid=""
                  setIDs "imageid" "image" "" "" 20
                  if [[ $(curl -ks http://${web}service/locationcheck.php 2>/dev/null) == "##" ]]; then
                      while [[ -z $askme ]]; do
                          echo -n "    Would you like to assign a location for this host? (y/N) "
                          read askme
                          case $askme in
                              [Nn]|[Nn][Oo]|"")
                                  askme="N"
                                  ;;
                              [Yy]|[Yy][Ee][Ss])
                                  setIDs "locationid" "location" "" "" 20
                                  location64=$locationid
                                  ;;
                              *)
                                  askme=""
                                  echo " * Invalid input, please try again"
                                  ;;
                          esac
                      done
                  fi
                  echo " * You entered all required information, "
                  askme=""
                  while [[ -z $askme ]]; do
                      echo -n "    Would you like to deploy image to this computer now? (y/N) "
                      read askme
                      case $askme in
                          [Nn]|[Nn][Oo]|"")
                              askme="N"
                              ;;
                          [Yy]|[Yy][Ee][Ss])
                              tmp=""
                              ret=""
                              retry=3
                              while [[ $ret != "#!ok" && ! $retry -eq 0 ]]; do
                                  echo " * Enter FOG GUI Username and Password"
                                  echo -n "    Username: "
                                  read username
                                  echo -n "    Password: "
                                  read -s password
                                  user64=$(echo $username | tr -d '\012' | base64)
                  
                  J 1 Reply Last reply Sep 13, 2017, 3:42 PM Reply Quote 0
                  • J
                    JGallo @JGallo
                    last edited by Sep 13, 2017, 3:42 PM

                    @jgallo

                                  pass64=$(echo $password | tr -d '\012' | base64)
                                    ret=$(curl -ks --data "mac=$mac&username=$user64&password=$pass64" http://${web}service/checkcredentials.php 2>/dev/null)
                                    case $ret in
                                        '#!ok')
                                            echo
                                            echo " * This host will reboot and deployment will start!"
                                            ret=$tmp
                                            realdoimage=$(echo -n 1 | base64)
                                            break
                                            ;;
                                        '#!il')
                                            echo
                                            echo " * Error: Invalid Login! ($retry remaining)"
                                            let retry-=1
                                            ;;
                                    esac
                                done
                                askme="Y"
                                ;;
                            *)
                                askme=""
                                echo " * Invalid input, please try again"
                                ;;
                        esac
                    done
                    dots "Attempting to register host"
                    res=""
                    while [[ -z $res ]]; do
                        res=$(curl -ks --data "mac=$mac&advanced=$(echo -n 1 | base64)&host=$host&imageid=$imageid&doimage=$realdoimage&location=$location64&username=$user64" http://${web}service/auto.register.php 2>/dev/null)
                        echo "$res"
                        usleep 2000000
                    done
                    . /bin/fog.inventory
                    usleep 2000000
                    
                    
                    T 1 Reply Last reply Sep 13, 2017, 3:44 PM Reply Quote 0
                    • J
                      JGallo @Tom Elliott
                      last edited by Sep 13, 2017, 3:43 PM

                      @tom-elliott

                      Sorry if this looks sloppy. Is there an easy way to copy the code completely and paste it here on the forum?

                      1 Reply Last reply Reply Quote 0
                      • T
                        Tom Elliott @JGallo
                        last edited by Sep 13, 2017, 3:44 PM

                        @jgallo In particular, to fix this for you. Edit your “curl” lines. CHange the parts that say http://${web}... to just state ${web}...

                        (… = all the other data).

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                        J 1 Reply Last reply Sep 13, 2017, 8:05 PM Reply Quote 0
                        • J
                          JGallo @Tom Elliott
                          last edited by Sep 13, 2017, 8:05 PM

                          @tom-elliott
                          Thank you. I will test later once replication is complete on RC7 server. As for replication on RC9, is there an issue? I did notice someone mentioning to go back to RC7 on a separate post.

                          T 1 Reply Last reply Sep 13, 2017, 8:16 PM Reply Quote 0
                          • T
                            Tom Elliott @JGallo
                            last edited by Sep 13, 2017, 8:16 PM

                            @jgallo only in that case that I’m aware of. I don’t know what the problem is though I suspect it’s because firewalls are blocking access to port 21.

                            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            1 / 1
                            • First post
                              10/13
                              Last post

                            200

                            Online

                            12.0k

                            Users

                            17.3k

                            Topics

                            155.2k

                            Posts
                            Copyright © 2012-2024 FOG Project