18 Commits

Author SHA1 Message Date
5952486df8 podman network inspect: include running containers
Like docker podman network inspect should output the information of
running container with their ip/mac address on this network.
However the output format is not docker compatible as this cannot
include all the info we have and the previous output was already not
compatible so this is not new.

New example output:
```
[
     {
          ...
          "containers": {
               "7c0d295779cee4a6db7adc07a99e635909413a390eeab9f951edbc4aac406bf1": {
                    "name": "c2",
                    "interfaces": {
                         "eth0": {
                              "subnets": [
                                   {
                                        "ipnet": "10.89.0.4/24",
                                        "gateway": "10.89.0.1"
                                   },
                                   {
                                        "ipnet": "fda3:b4da:da1e:7e9d::4/64",
                                        "gateway": "fda3:b4da:da1e:7e9d::1"
                                   }
                              ],
                              "mac_address": "1a:bd:ca:ea:4b:3a"
                         }
                    }
               },
               "b17c6651ae6d9cc7d5825968e01d6b1e67f44460bb0c140bcc32bd9d436ac11d": {
                    "name": "c1",
                    "interfaces": {
                         "eth0": {
                              "subnets": [
                                   {
                                        "ipnet": "10.89.0.3/24",
                                        "gateway": "10.89.0.1"
                                   },
                                   {
                                        "ipnet": "fda3:b4da:da1e:7e9d::3/64",
                                        "gateway": "fda3:b4da:da1e:7e9d::1"
                                   }
                              ],
                              "mac_address": "f6:50:e6:22:d9:55"
                         }
                    }
               }
          }
     }
]
```

Fixes #14126
Fixes https://issues.redhat.com/browse/RHEL-3153

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-02-28 16:33:26 +01:00
dbe0e67897 Man pages: tighter documenting of --format fields
Initial impetus was #20958 (ps --format .Label abc). This is
a complicated solution to a simple-seeming problem.

The problem: .Label is a cobra *function*, something I did not
know about nor handle.

Solution: recognize cobra functions. Switch to __complete,
not __completeNoDesc, so we can see the number of arguments
required. Invent new man-page format for documenting functions.
And, finally, start enforcing how functions (and cobra structs)
are documented.

This discovered a never-used completion function, .Recycle(),
in podman-events. Remove it.

[NO NEW TESTS NEEDED] - the .go change is an excision of dead code.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-01-15 13:11:27 -07:00
8bf168cc13 Add ability to set static routes
add routes using the --route flag.
the no_default_route option in --opt prevents a default route from
getting added automatically.

Signed-off-by: Jan Hendrik Farr <github@jfarr.cc>
2023-06-12 10:31:59 +02:00
de92db0c81 man pages and command help: clean up descriptions
Short description in man pages:
* Use imperative form

Command help (cobra.Command.Short):
* Capitalize first letter
* Use imperative form
* Remove ending full stop when the short description
  only contains one sentence without any commas

Command help (cobra.Command.Long):
* Capitalize first letter unless the sentence starts
  with a command "podman command ..."
* Use imperative form when the long description is
  identical or almost identical to the short description.
  This modification was only done in a few places.

Command tables:
* Use imperative form in the "Description" column

[NO NEW TESTS NEEDED]

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-05-28 18:57:43 +02:00
3a9d14d4e9 man page --format xref: tighten the autocompletion check
Followup to #17486: stricter checks on --format.

  * If a subcommand offers autocompletion for templates,
    it must also offer a '--format json' option.

  * If a subcommand has a --format option that DOES NOT
    offer autocompletion for templates, it must be listed
    in a hardcoded grandparented-in table of commands
    where that's not applicable. (Mostly commands
    like build, commit, save, where "format" is used
    in the context of "oci/docker").

Only likely to trigger on PRs which add new subcommands,
and is intended to catch oversights.

Also, test for alphanumeric order in man page tables.
Sort all existing tables.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-14 08:11:54 -07:00
4334135491 [CI:DOCS] man-page checker: include --format (Go templates)
Very belated successor to #14046.

I don't know why this is so important to me. Probably because we're
doing a halfhearted sloppy job of documenting, and new options get
added, and not documented, and that's just wrong.

I've given up on documenting internal structs. This iteration
has a $Format_Exceptions table defined at the top of the xref
script, enumerating a hardcoded defined set of podman commands
and fields that should remain undocumented.

This iteration also forgives completely-undocumented formats.
If podman-foo has a --format, but podman-foo.1.md does not
list *any* valid fields, the script warns but does not fail.
This at least is better than documenting a random mix of fields.

This version of the xref script is much slower: 10s vs 4. I
think we can live with that in a CI-only script.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-08 15:33:45 -07:00
63c779a857 Fix manpage headers
Signed-off-by: Andrew Denton <adenton@redhat.com>
2022-09-06 09:37:13 -07:00
cbdda4e56e docs: remove CNI word where it is not applicable
Most network commands/features work with both netavark and CNI. When
we added added netavark most docs were not vetted and thus still use CNI
network, it should just say network.

Fixes #14990

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-22 13:46:28 +02:00
4a166c8b63 podman network: add documentation for netavark
Add some docs about the different network backends. Also remove the CNI
word from network since we refer to either a netavark or CNI config.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-15 16:46:23 +01:00
85e8fbf7f3 Wire network interface into libpod
Make use of the new network interface in libpod.

This commit contains several breaking changes:
- podman network create only outputs the new network name and not file
  path.
- podman network ls shows the network driver instead of the cni version
  and plugins.
- podman network inspect outputs the new network struct and not the cni
  conflist.
- The bindings and libpod api endpoints have been changed to use the new
  network structure.

The container network status is stored in a new field in the state. The
status should be received with the new `c.getNetworkStatus`. This will
migrate the old status to the new format. Therefore old containers should
contine to work correctly in all cases even when network connect/
disconnect is used.

New features:
- podman network reload keeps the ip and mac for more than one network.
- podman container restore keeps the ip and mac for more than one
  network.
- The network create compat endpoint can now use more than one ipam
  config.

The man pages and the swagger doc are updated to reflect the latest
changes.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-15 20:00:20 +02:00
30e731ecc8 Revert escaped double dash man page flag syntax
Commit 800a2e2d35 introduced a way to disable the conversion of `--`into
an en dash on docs.podman.io, so the ugly workaround of escaping the
dashes is no longer necessary.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-05-07 18:30:00 +02:00
bc48211924 Fix long option format on docs.podman.io
Escape the two dashes, otherwise they are combined into one long dash.
I tested that this change is safe and still renders correctly on github
and with the man pages.

This commit also contains a small change to make it build locally.
Assuming you have the dependencies installed you can do:
```
cd docs
make html
```
Preview the html files in docs/build/html with
`python -m http.server 8000 --directory build/html`.

Fixes containers/podman.io#373

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-03-29 14:38:25 +02:00
8437a6df16 Correct which network commands can be run as rootless
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-03 14:43:37 +01:00
52a8694705 Add anchors for flag names on docs.podman.io
Change the docs markdown so that flag names will be h4 headers.
Sphinx will automatically add anchors to headers. Add css to
make sure the flag names are not to big compared to the text.

The man pages also still renders fine but it looks a bit different.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-10 15:27:08 +01:00
c6090c290e Docs: consistency between man / --help
New functionality in hack/man-page-checker: start cross-
referencing the man page 'Synopsis' line against the
output of 'podman foo --help'. This is part 1, flag/option
consistency. Part 2 (arg consistency) is too big and will
have to wait for later.

flag/option consistency means: if 'podman foo --help'
includes the string '[flags]' in the Usage message,
make sure the man page includes '[*options*]' in its
Synopsis line, and vice-versa. This found several
inconsistencies, which I've fixed.

While doing this I realized that Cobra automatically
includes a 'Flags:' subsection in its --help output
for all subcommands that have defined flags. This
is great - it lets us cross-check against the
usage synopsis, and make sure that '[flags]' is
present or absent as needed, without fear of
human screwups. If a flag-less subcommand ever
gets extended with flags, but the developer forgets
to add '[flags]' and remove DisableFlagsInUseLine,
we now have a test that will catch that. (This,
too, caught two instances which I fixed).

I don't actually know if the new man-page-checker
functionality will work in CI: I vaguely recall that
it might run before 'make podman' does; and also
vaguely recall that some steps were taken to remedy
that.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-24 10:39:10 -06:00
35567e706b Attempt to turn on additional build tests
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-22 12:55:23 -04:00
ade20f3323 format option added to network inspect command.
This helps user to print the inspect output in go template format.

Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
2020-05-20 02:53:47 +00:00
486fcd4e1e Update document formatting and packaging code
* Refactored code and Makefile to support new docs layout
* Removed some old code packaging code
* Add Readme.md to document what we're doing

Signed-off-by: Jhon Honce <jhonce@redhat.com>
Signed-off-by: baude <bbaude@redhat.com>
2019-10-31 12:31:39 -05:00