Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coconut/cmd/configuration_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ coconut conf history <component>/<entry>`,
Long: `The configuration history command returns all entries with
all of their associated timestamps or returns all timestamps for a specified component and entry`,
Run: configuration.WrapCall(configuration.History),
Args: cobra.RangeArgs(0, 3),
Args: cobra.RangeArgs(0, 3),
}

func init() {
Expand Down
55 changes: 55 additions & 0 deletions coconut/cmd/configuration_import.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* === This file is part of ALICE O² ===
*
* Copyright 2019 CERN and copyright holders of ALICE O².
* Author: George Raduta <george.raduta@cern.ch>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In applying this license CERN does not waive the privileges and
* immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*/

package cmd

import (
"github.com/AliceO2Group/Control/coconut/configuration"
"github.com/spf13/cobra"
)

var configurationImportCmd = &cobra.Command{
Use: "import <component> <entry> <file_path>",
Aliases: []string{"i", "imp"},
Example: `coconut conf import <component> <entry> <file_path>
coconut conf import <component>/<entry> <file_path>
coconut conf import <component> <entry> <file_path> --new-component
coconut conf import <component>/<entry> <file_path> --format=json
coconut conf import <component> <entry> <file_path>.json
`,
Short: "Import a configuration file for the specified component and entry",
Long: `The configuration import command generates a timestamp and saves
the configuration file to Consul under the <component>/<entry>/<timestamp> path.
Supported configuration file types are JSON, YAML, TOML and INI,
and their file extensions are recognized automatically.`,
Run: configuration.WrapCall(configuration.Import),
Args: cobra.RangeArgs(1, 4),
}

func init() {
configurationCmd.AddCommand(configurationImportCmd)
configurationImportCmd.Flags().BoolP("new-component", "n", false, "create a new configuration component while importing entry")
configurationImportCmd.Flags().StringP("format", "f", "", "force a specific configuration file type, overriding any file extension")

}
6 changes: 3 additions & 3 deletions coconut/cmd/configuration_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ coconut conf show <component>/<entry>
coconut conf show <component>/<entry> -t <timestamp>
coconut conf show <component>/<entry>@<timestamp>`,
Short: "Show configuration for the component and entry specified",
Long: `The configuration show command requests by default the latest
configuration for the specified component and entry. It can request exact
time configuration by specifying wanted timestamp as flag`,
Long: `The configuration show command returns the most recent
configuration revision for the specified component and entry.
It can also return a specific revision, requested with the --timestamp/-t flag`,
Run: configuration.WrapCall(configuration.Show),
Args: cobra.RangeArgs(0, 3),
}
Expand Down
Loading