title: Successfully Install Artifactory RPM using Salt-Stack
body: <p>I am working on fully automating some things using Salt Stack. I am currently working on installing Artifactory v5.3.2 using a RPM via Salt Stack. I am able to get this to install and work properly but begin getting a false-positive error from salt stack. </p>
  
  <p>Currently running on <code>CentOS Linux release 7.3.1611 (Core)</code> with a masterless salt stack (just for testing purposes) from <a href="https://docs.saltstack.com/en/latest/topics/tutorials/quickstart.html" rel="nofollow noreferrer">here</a>. According to Artifactory documentation; they recommend using yum to install the rpm package. <a href="https://www.jfrog.com/confluence/display/RTF/Installing+on+Linux+Solaris+or+Mac+OS#InstallingonLinuxSolarisorMacOS-RPMorDebianInstallation" rel="nofollow noreferrer"> Installing Artifactory OSS from an RPM disribution</a>. </p>
  
  <p>I am aware of two salt-formula's for a similar use case but, these are over complicated for our needs. I attempted to post the two urls for them but don't have enough reputation for saltstack to allow me to do so.</p>
  
  <p>After Downloading the rpm and placing it in the correct directory.. using this salt stack configuration does NOT work properly on the first attempt of an install: </p>
  
  <pre><code>jfrog-artifactory-oss.noarch:
    pkg.installed:
      - source: salt://path/conf/jfrog-artifactory-oss-5.3.2.rpm
  </code></pre>
  
  <p>returning an error message like so: </p>
  
  <pre><code>ID: jfrog-artifactory-oss.noarch
  Function: pkg.installed
    Result: False
   Comment: Error occurred installing package(s). Additional info follows:`
  
           errors:
                - Running scope as unit run-2994.scope.
                  Loaded plugins: fastestmirror
                  Loading mirror speeds from cached hostfile
                   * base: mirror.steadfast.net
                   * epel: mirror.steadfast.net
                   * extras: repo.us.bigstepcloud.com
                   * updates: mirrors.lga7.us.voxel.net
                  No package jfrog-artifactory-oss available.
                  Error: Nothing to do
   Started: 15:51:12.374898
  Duration: 11271.36 ms
   Changes:
  </code></pre>
  
  <p>Using this configuration for salt: </p>
  
  <pre><code>jfrog-artifactory-oss.noarch:
    cmd.run:
      - name: yum install -y /srv/salt/prod/path/conf/jfrog-artifactory-oss-5.3.2.rpm
  </code></pre>
  
  <p>Works the first time but, the second time running it using this format returns an error like so: </p>
  
  <pre><code>          stderr:
                Error: Nothing to do
            stdout:
                Loaded plugins: fastestmirror
                Examining /srv/salt/prod/path/conf/jfrog-artifactory-oss-5.3.2.rpm: jfrog-artifactory-oss-5.3.2-50047.noarch
                /srv/salt/prod/path/conf/jfrog-artifactory-oss-5.3.2.rpm: does not update installed package.
  </code></pre>
  
  <p>Now, not to make things confusing.. if I have artifactory installed, and I then revert back to the first method of installing this using the <code>pkg.installed</code> method, things work as expected returning a success message saying '<em>All specified packages are already installed</em>'.</p>
  
  <p>Typically this false positive is caused by not using the correct name of the package in the salt state file so running <code>yum list installed</code> returns <code>jfrog-artifactory-oss.noarch</code> ensuring I am using the correct naming in the salt state. </p>
  
  <p>I am looking to have this work successfully regardless of if it is updating the package or not; without needing to over complicate our set up with the salt formulas provided. </p>
  
  <p>Any help/advice would be greatly appreciated.</p>