Package build with Saltstack











up vote
0
down vote

favorite












I'm attempting to get a specific package pulled from Github and installed with Salt (in a masterless configuration) when provisioning a machine. So far, I've managed to do so like this:



{% set pkg = {
'Ubuntu': 'https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb',
}.get(grains.os) %}

curl -O -L {{ pkg }}:
cmd.run

dpkg -i some-pakage-v1-unknown-linux-gnu.deb:
cmd.run


Now, Salt does have a module that seems to do this exact thing, it's called pkgbuild.built. I tried using it but without much success. This is what I've right at the moment:



some-pakage-v1:
pkgbuild.built:
- runas: root
- results:
- some-package-v1-unknown-linux-gnu.deb
- dest_dir: /tmp/pkg
- spec: salt://pkg/salt/spec/some-package.spec
- tgt: ubuntu-18.04.1-x86_64
- sources:
- {{ pkg }}


And I'm getting this error:



      ID: some-pakage-v1
Function: pkgbuild.built
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1913, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1898, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/states/pkgbuild.py", line 207, in built
ret['changes'] = __salt__[func](
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1155, in __getitem__
func = super(LazyLoader, self).__getitem__(item)
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 104, in __getitem__
raise KeyError(key)
KeyError: 'pkgbuild.build'
Started: 18:29:57.051892
Duration: 9.644 ms
Changes:









share|improve this question




























    up vote
    0
    down vote

    favorite












    I'm attempting to get a specific package pulled from Github and installed with Salt (in a masterless configuration) when provisioning a machine. So far, I've managed to do so like this:



    {% set pkg = {
    'Ubuntu': 'https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb',
    }.get(grains.os) %}

    curl -O -L {{ pkg }}:
    cmd.run

    dpkg -i some-pakage-v1-unknown-linux-gnu.deb:
    cmd.run


    Now, Salt does have a module that seems to do this exact thing, it's called pkgbuild.built. I tried using it but without much success. This is what I've right at the moment:



    some-pakage-v1:
    pkgbuild.built:
    - runas: root
    - results:
    - some-package-v1-unknown-linux-gnu.deb
    - dest_dir: /tmp/pkg
    - spec: salt://pkg/salt/spec/some-package.spec
    - tgt: ubuntu-18.04.1-x86_64
    - sources:
    - {{ pkg }}


    And I'm getting this error:



          ID: some-pakage-v1
    Function: pkgbuild.built
    Result: False
    Comment: An exception occurred in this state: Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1913, in call
    **cdata['kwargs'])
    File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1898, in wrapper
    return f(*args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/salt/states/pkgbuild.py", line 207, in built
    ret['changes'] = __salt__[func](
    File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1155, in __getitem__
    func = super(LazyLoader, self).__getitem__(item)
    File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 104, in __getitem__
    raise KeyError(key)
    KeyError: 'pkgbuild.build'
    Started: 18:29:57.051892
    Duration: 9.644 ms
    Changes:









    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm attempting to get a specific package pulled from Github and installed with Salt (in a masterless configuration) when provisioning a machine. So far, I've managed to do so like this:



      {% set pkg = {
      'Ubuntu': 'https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb',
      }.get(grains.os) %}

      curl -O -L {{ pkg }}:
      cmd.run

      dpkg -i some-pakage-v1-unknown-linux-gnu.deb:
      cmd.run


      Now, Salt does have a module that seems to do this exact thing, it's called pkgbuild.built. I tried using it but without much success. This is what I've right at the moment:



      some-pakage-v1:
      pkgbuild.built:
      - runas: root
      - results:
      - some-package-v1-unknown-linux-gnu.deb
      - dest_dir: /tmp/pkg
      - spec: salt://pkg/salt/spec/some-package.spec
      - tgt: ubuntu-18.04.1-x86_64
      - sources:
      - {{ pkg }}


      And I'm getting this error:



            ID: some-pakage-v1
      Function: pkgbuild.built
      Result: False
      Comment: An exception occurred in this state: Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1913, in call
      **cdata['kwargs'])
      File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1898, in wrapper
      return f(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/states/pkgbuild.py", line 207, in built
      ret['changes'] = __salt__[func](
      File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1155, in __getitem__
      func = super(LazyLoader, self).__getitem__(item)
      File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 104, in __getitem__
      raise KeyError(key)
      KeyError: 'pkgbuild.build'
      Started: 18:29:57.051892
      Duration: 9.644 ms
      Changes:









      share|improve this question















      I'm attempting to get a specific package pulled from Github and installed with Salt (in a masterless configuration) when provisioning a machine. So far, I've managed to do so like this:



      {% set pkg = {
      'Ubuntu': 'https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb',
      }.get(grains.os) %}

      curl -O -L {{ pkg }}:
      cmd.run

      dpkg -i some-pakage-v1-unknown-linux-gnu.deb:
      cmd.run


      Now, Salt does have a module that seems to do this exact thing, it's called pkgbuild.built. I tried using it but without much success. This is what I've right at the moment:



      some-pakage-v1:
      pkgbuild.built:
      - runas: root
      - results:
      - some-package-v1-unknown-linux-gnu.deb
      - dest_dir: /tmp/pkg
      - spec: salt://pkg/salt/spec/some-package.spec
      - tgt: ubuntu-18.04.1-x86_64
      - sources:
      - {{ pkg }}


      And I'm getting this error:



            ID: some-pakage-v1
      Function: pkgbuild.built
      Result: False
      Comment: An exception occurred in this state: Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1913, in call
      **cdata['kwargs'])
      File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1898, in wrapper
      return f(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/states/pkgbuild.py", line 207, in built
      ret['changes'] = __salt__[func](
      File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1155, in __getitem__
      func = super(LazyLoader, self).__getitem__(item)
      File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 104, in __getitem__
      raise KeyError(key)
      KeyError: 'pkgbuild.build'
      Started: 18:29:57.051892
      Duration: 9.644 ms
      Changes:






      github salt-stack






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago

























      asked 2 days ago









      pierreb

      5281623




      5281623
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Could it be that you made a mistake in the indentation?



          According to the documentation, I would expect this:



          some-pakage-v1:
          pkgbuild.built:
          - runas: root
          - results:
          - some-package-v1-unknown-linux-gnu.deb
          - dest_dir: /tmp/pkg
          - spec: salt://pkg/salt/spec/some-package.spec
          - tgt: ubuntu-18.04.1-x86_64
          - sources:
          - {{ pkg }}


          The line after results has to be indented



          Still, in your case, if you want to install the .deb file, why not the pkg.installed rules?



          some-package-v1:
          pkg.installed:
          - sources: https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb




          share










          New contributor




          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Thank you for pointing out the indentation. It is in fact correct in my original file and I seem to have messed the formatting when copy-pasting it into my question though. As to the sources parameter, it is the right solution. I remember going through the documentation for the pkg.installed state but didn't find a reference to it. Thanks for the hint! I just had to adjust the format of the parameter as it was giving me an Invalidly formatted 'sources' parameter error (edited your answer accordingly).
            – pierreb
            7 hours ago











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53343546%2fpackage-build-with-saltstack%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          Could it be that you made a mistake in the indentation?



          According to the documentation, I would expect this:



          some-pakage-v1:
          pkgbuild.built:
          - runas: root
          - results:
          - some-package-v1-unknown-linux-gnu.deb
          - dest_dir: /tmp/pkg
          - spec: salt://pkg/salt/spec/some-package.spec
          - tgt: ubuntu-18.04.1-x86_64
          - sources:
          - {{ pkg }}


          The line after results has to be indented



          Still, in your case, if you want to install the .deb file, why not the pkg.installed rules?



          some-package-v1:
          pkg.installed:
          - sources: https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb




          share










          New contributor




          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Thank you for pointing out the indentation. It is in fact correct in my original file and I seem to have messed the formatting when copy-pasting it into my question though. As to the sources parameter, it is the right solution. I remember going through the documentation for the pkg.installed state but didn't find a reference to it. Thanks for the hint! I just had to adjust the format of the parameter as it was giving me an Invalidly formatted 'sources' parameter error (edited your answer accordingly).
            – pierreb
            7 hours ago















          up vote
          1
          down vote



          accepted










          Could it be that you made a mistake in the indentation?



          According to the documentation, I would expect this:



          some-pakage-v1:
          pkgbuild.built:
          - runas: root
          - results:
          - some-package-v1-unknown-linux-gnu.deb
          - dest_dir: /tmp/pkg
          - spec: salt://pkg/salt/spec/some-package.spec
          - tgt: ubuntu-18.04.1-x86_64
          - sources:
          - {{ pkg }}


          The line after results has to be indented



          Still, in your case, if you want to install the .deb file, why not the pkg.installed rules?



          some-package-v1:
          pkg.installed:
          - sources: https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb




          share










          New contributor




          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Thank you for pointing out the indentation. It is in fact correct in my original file and I seem to have messed the formatting when copy-pasting it into my question though. As to the sources parameter, it is the right solution. I remember going through the documentation for the pkg.installed state but didn't find a reference to it. Thanks for the hint! I just had to adjust the format of the parameter as it was giving me an Invalidly formatted 'sources' parameter error (edited your answer accordingly).
            – pierreb
            7 hours ago













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Could it be that you made a mistake in the indentation?



          According to the documentation, I would expect this:



          some-pakage-v1:
          pkgbuild.built:
          - runas: root
          - results:
          - some-package-v1-unknown-linux-gnu.deb
          - dest_dir: /tmp/pkg
          - spec: salt://pkg/salt/spec/some-package.spec
          - tgt: ubuntu-18.04.1-x86_64
          - sources:
          - {{ pkg }}


          The line after results has to be indented



          Still, in your case, if you want to install the .deb file, why not the pkg.installed rules?



          some-package-v1:
          pkg.installed:
          - sources: https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb




          share










          New contributor




          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          Could it be that you made a mistake in the indentation?



          According to the documentation, I would expect this:



          some-pakage-v1:
          pkgbuild.built:
          - runas: root
          - results:
          - some-package-v1-unknown-linux-gnu.deb
          - dest_dir: /tmp/pkg
          - spec: salt://pkg/salt/spec/some-package.spec
          - tgt: ubuntu-18.04.1-x86_64
          - sources:
          - {{ pkg }}


          The line after results has to be indented



          Still, in your case, if you want to install the .deb file, why not the pkg.installed rules?



          some-package-v1:
          pkg.installed:
          - sources: https://github.com/some-package/releases/download/v1/some-package-v1-unknown-linux-gnu.deb





          share










          New contributor




          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.








          share


          share








          edited 19 hours ago





















          New contributor




          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered yesterday









          agm650

          262




          262




          New contributor




          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          agm650 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.












          • Thank you for pointing out the indentation. It is in fact correct in my original file and I seem to have messed the formatting when copy-pasting it into my question though. As to the sources parameter, it is the right solution. I remember going through the documentation for the pkg.installed state but didn't find a reference to it. Thanks for the hint! I just had to adjust the format of the parameter as it was giving me an Invalidly formatted 'sources' parameter error (edited your answer accordingly).
            – pierreb
            7 hours ago


















          • Thank you for pointing out the indentation. It is in fact correct in my original file and I seem to have messed the formatting when copy-pasting it into my question though. As to the sources parameter, it is the right solution. I remember going through the documentation for the pkg.installed state but didn't find a reference to it. Thanks for the hint! I just had to adjust the format of the parameter as it was giving me an Invalidly formatted 'sources' parameter error (edited your answer accordingly).
            – pierreb
            7 hours ago
















          Thank you for pointing out the indentation. It is in fact correct in my original file and I seem to have messed the formatting when copy-pasting it into my question though. As to the sources parameter, it is the right solution. I remember going through the documentation for the pkg.installed state but didn't find a reference to it. Thanks for the hint! I just had to adjust the format of the parameter as it was giving me an Invalidly formatted 'sources' parameter error (edited your answer accordingly).
          – pierreb
          7 hours ago




          Thank you for pointing out the indentation. It is in fact correct in my original file and I seem to have messed the formatting when copy-pasting it into my question though. As to the sources parameter, it is the right solution. I remember going through the documentation for the pkg.installed state but didn't find a reference to it. Thanks for the hint! I just had to adjust the format of the parameter as it was giving me an Invalidly formatted 'sources' parameter error (edited your answer accordingly).
          – pierreb
          7 hours ago


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53343546%2fpackage-build-with-saltstack%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Paul Cézanne

          UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

          Angular material date-picker (MatDatepicker) auto completes the date on focus out