summaryrefslogtreecommitdiff
path: root/distro/common/html/knife_diff.html
blob: e6bdf1d582d9731855bcd188a415c66c9908bc99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>knife diff &mdash; Knife Man Pages</title>
    
    <link rel="stylesheet" href="_static/chef.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="shortcut icon" href="_static/chef.ico"/>
    <link rel="top" title="Knife Man Pages" href="index.html" /> 
  </head>
  <body>
<div style="background-color: #212c35; text-align: left; padding: 0px 0px 0px 0px">
<a href="http://docs.opscode.com/"><img src="_static/chef_html_logo.png" border="0" alt="Chef"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li><a href="http://docs.opscode.com/chef/knife.html" target="_products">Knife</a>&#149;</li>
        <li><a href="http://docs.opscode.com/chef/resources.html" target="_products">Resources</a>&#149;</li>
        <li><a href="http://docs.opscode.com/chef/dsl_recipe.html" target="_products">Recipe DSL</a>&#149;</li>
        <li><a href="http://docs.opscode.com/chef/lwrps_custom.html" target="_products">LWRPs</a>&#149;</li>
        <li><a href="http://docs.opscode.com/search.html">Search the Docs</a>&#149;</li>
        <li><a href="http://docs.opscode.com/">Home</a> &raquo;</li>
 
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="knife.html">
              <img class="logo" src="_static/chef_logo.png" alt="Logo"/>
            </a></p>
  <h3><a href="knife.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">knife diff</a><ul>
<li><a class="reference internal" href="#syntax">Syntax</a></li>
<li><a class="reference internal" href="#options">Options</a><ul>
<li><a class="reference internal" href="#knife-rb-settings">knife.rb Settings</a></li>
</ul>
</li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
</ul>

        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="knife-diff">
<h1>knife diff<a class="headerlink" href="#knife-diff" title="Permalink to this headline">¶</a></h1>
<p>The <strong>knife diff</strong> subcommand is used to compare the differences between files and directories on the server and in the chef-repo. For example, to compare files on the server prior to an uploading or downloading files using the <tt class="docutils literal"><span class="pre">knife</span> <span class="pre">download</span></tt> and <tt class="docutils literal"><span class="pre">knife</span> <span class="pre">upload</span></tt> subcommands, or to ensure that certain files in multiple production environments are the same. This subcommand is similar to the <tt class="docutils literal"><span class="pre">git</span> <span class="pre">diff</span></tt> command that can be used to diff what is in the chef-repo with what is synced to a git repository.</p>
<div class="section" id="syntax">
<h2>Syntax<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h2>
<p>This argument has the following syntax:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>knife diff <span class="o">[</span>PATTERN...<span class="o">]</span> <span class="o">(</span>options<span class="o">)</span>
</pre></div>
</div>
</div>
<div class="section" id="options">
<h2>Options<a class="headerlink" href="#options" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Review the list of <a class="reference internal" href="knife_common_options.html"><em>common options</em></a> available to this (and all) Knife subcommands and plugins.</p>
</div>
<p>This subcommand has the following options:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--chef-repo-path</span> <span class="pre">PATH</span></tt></dt>
<dd>The path to the chef-repo. This setting will override the default path to the chef-repo. Default: same as specified by <tt class="docutils literal"><span class="pre">chef_repo_path</span></tt> in config.rb.</dd>
<dt><tt class="docutils literal"><span class="pre">--cookbook-version</span> <span class="pre">VERSION</span></tt></dt>
<dd>The version of a cookbook to be downloaded.</dd>
<dt><tt class="docutils literal"><span class="pre">--concurrency</span></tt></dt>
<dd>The number of allowed concurrent connections. Default: <tt class="docutils literal"><span class="pre">10</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">--diff-filter=[(A|D|M|T)...[*]]</span></tt></dt>
<dd>Indicates that files will be selected that have been added (<tt class="docutils literal"><span class="pre">A</span></tt>), deleted (<tt class="docutils literal"><span class="pre">D</span></tt>), modified (<tt class="docutils literal"><span class="pre">M</span></tt>), and/or have had their type changed (<tt class="docutils literal"><span class="pre">T</span></tt>). Any combination of filter characters may be used, including no filter characters. Use <tt class="docutils literal"><span class="pre">*</span></tt> to select all paths if a file matches other criteria in the comparison. Default value: <tt class="docutils literal"><span class="pre">nil</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">--name-only</span></tt></dt>
<dd>Indicates that only the names of modified files will be shown.</dd>
<dt><tt class="docutils literal"><span class="pre">--name-status</span></tt></dt>
<dd>Indicates that only the names of files with a status of <tt class="docutils literal"><span class="pre">Added</span></tt>, <tt class="docutils literal"><span class="pre">Deleted</span></tt>, <tt class="docutils literal"><span class="pre">Modified</span></tt>, or <tt class="docutils literal"><span class="pre">Type</span> <span class="pre">Changed</span></tt> will be shown.</dd>
<dt><tt class="docutils literal"><span class="pre">--no-recurse</span></tt></dt>
<dd>Use <tt class="docutils literal"><span class="pre">--no-recurse</span></tt> to disable listing a directory recursively. Default: <tt class="docutils literal"><span class="pre">--recurse</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">--repo-mode</span> <span class="pre">MODE</span></tt></dt>
<dd>The layout of the local chef-repo. Possible values: <tt class="docutils literal"><span class="pre">static</span></tt>, <tt class="docutils literal"><span class="pre">everything</span></tt>, or <tt class="docutils literal"><span class="pre">hosted_everything</span></tt>. Use <tt class="docutils literal"><span class="pre">static</span></tt> for just roles, environments, cookbooks, and data bags. By default, <tt class="docutils literal"><span class="pre">everything</span></tt> and <tt class="docutils literal"><span class="pre">hosted_everything</span></tt> are dynamically selected depending on the server type. Default: <tt class="docutils literal"><span class="pre">everything</span></tt> / <tt class="docutils literal"><span class="pre">hosted_everything</span></tt>.</dd>
</dl>
<div class="section" id="knife-rb-settings">
<h3>knife.rb Settings<a class="headerlink" href="#knife-rb-settings" title="Permalink to this headline">¶</a></h3>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">See <tt class="xref doc docutils literal"><span class="pre">knife.rb</span></tt> for more information about how to add optional settings to the knife.rb file.</p>
</div>
<p>The following <tt class="docutils literal"><span class="pre">knife</span> <span class="pre">diff</span></tt> settings can be added to the knife.rb file:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">knife[:chef_repo_path]</span></tt></dt>
<dd>Use to add the <tt class="docutils literal"><span class="pre">--chef-repo-path</span></tt> option.</dd>
<dt><tt class="docutils literal"><span class="pre">knife[:concurrency]</span></tt></dt>
<dd>Use to add the <tt class="docutils literal"><span class="pre">--concurrency</span></tt> option.</dd>
<dt><tt class="docutils literal"><span class="pre">knife[:name_only]</span></tt></dt>
<dd>Use to add the <tt class="docutils literal"><span class="pre">--name-only</span></tt> option.</dd>
<dt><tt class="docutils literal"><span class="pre">knife[:name_status]</span></tt></dt>
<dd>Use to add the <tt class="docutils literal"><span class="pre">--name-status</span></tt> option.</dd>
<dt><tt class="docutils literal"><span class="pre">knife[:recurse]</span></tt></dt>
<dd>Use to add the <tt class="docutils literal"><span class="pre">--recurse</span></tt> option.</dd>
<dt><tt class="docutils literal"><span class="pre">knife[:repo_mode]</span></tt></dt>
<dd>Use to add the <tt class="docutils literal"><span class="pre">--repo-mode</span></tt> option.</dd>
</dl>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<p>The following examples show how to use this Knife subcommand:</p>
<p><strong>Compare files that contain JSON data</strong></p>
<p>To compare the &#8220;base.json&#8221; role to a &#8220;webserver.json&#8221; role, enter:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>knife diff roles/base.json roles/webserver.json
</pre></div>
</div>
<p><strong>Compare the chef-repo and the server</strong></p>
<p>To compare the differences between the local chef-repo and the files that are on the server, enter:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>knife diff
</pre></div>
</div>
<p><strong>Compare, then return results</strong></p>
<p>To diff a node named <tt class="docutils literal"><span class="pre">node-lb</span></tt> and then only return files that have been added, deleted, modified, or changed, enter:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>knife diff --name-status node-lb
</pre></div>
</div>
<p>to return something like:</p>
<div class="highlight-bash"><div class="highlight"><pre>node-lb/recipes/eip.rb
node-lb/recipes/heartbeat-int.rb
node-lb/templates/default/corpsite.conf.erb
node-lb/files/default/wildcard.node.com.crt
node-lb/files/default/wildcard.node.com.crt-2009
node-lb/files/default/wildcard.node.com.key
node-lb/.gitignore
node-lb/Rakefile
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li><a href="http://docs.opscode.com/chef/knife.html" target="_products">Knife</a>&#149;</li>
        <li><a href="http://docs.opscode.com/chef/resources.html" target="_products">Resources</a>&#149;</li>
        <li><a href="http://docs.opscode.com/chef/dsl_recipe.html" target="_products">Recipe DSL</a>&#149;</li>
        <li><a href="http://docs.opscode.com/chef/lwrps_custom.html" target="_products">LWRPs</a>&#149;</li>
        <li><a href="http://docs.opscode.com/search.html">Search the Docs</a>&#149;</li>
        <li><a href="http://docs.opscode.com/">Home</a> &raquo;</li>
 
      </ul>
    </div>


    <div class="footer">
      Documentation for current man pages for Knife.

    &nbsp;Send feedback to <a href="mailto:docs@getchef.com">docs@getchef.com</a>.
       This work is licensed under a Creative Commons Attribution 3.0 Unported License. 

    </div>

<!-- Start of Async Google Analytics Code -->
<script type="text/javascript">
var _gaq = _gaq || [];
var pluginUrl = (('https:' == document.location.protocol) ? 'https://ssl.' : 'http://www.') + 'google-analytics.com/plugins/ga/inpage_linkid.js';
_gaq.push(['_setAccount', 'UA-6369228-7']);
_gaq.push(['_setDomainName', '.opscode.com']);
_gaq.push(['_setAllowHash', false]);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_addIgnoredRef','opscode.com']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript';
  ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(ga, s); })();
</script>
<!-- End of Async Google Analytics Code -->



<!-- Start of Contact Analytics Code -->
<script type="text/javascript">
(function() {
  var didInit = false;
  function initMunchkin() {
    if(didInit === false) {
      didInit = true;
      Munchkin.init('255-VFB-268');
    }
  }
  var s = document.createElement('script');
  s.type = 'text/javascript';
  s.async = true;
  s.src = document.location.protocol + '//munchkin.marketo.net/munchkin.js';
  s.onreadystatechange = function() {
    if (this.readyState == 'complete' || this.readyState == 'loaded') {
      initMunchkin();
    }
  };
  s.onload = initMunchkin;
  document.getElementsByTagName('head')[0].appendChild(s);
})();
</script>
<!-- End of Contact Analytics Code -->


  </body>
</html>