当前位置: 首页>>代码示例>>Golang>>正文


Golang series.SupportedSeries函数代码示例

本文整理汇总了Golang中github.com/juju/utils/series.SupportedSeries函数的典型用法代码示例。如果您正苦于以下问题:Golang SupportedSeries函数的具体用法?Golang SupportedSeries怎么用?Golang SupportedSeries使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SupportedSeries函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestFindAvailableToolsCompleteNoValidate

func (s *toolsSuite) TestFindAvailableToolsCompleteNoValidate(c *gc.C) {
	s.PatchValue(&arch.HostArch, func() string { return arch.AMD64 })

	var allTools tools.List
	for _, series := range series.SupportedSeries() {
		binary := version.Binary{
			Number: version.Current,
			Series: series,
			Arch:   arch.HostArch(),
		}
		allTools = append(allTools, &tools.Tools{
			Version: binary,
			URL:     "http://testing.invalid/tools.tar.gz",
		})
	}

	s.PatchValue(bootstrap.FindTools, func(_ environs.Environ, major, minor int, stream string, f tools.Filter) (tools.List, error) {
		return allTools, nil
	})
	env := newEnviron("foo", useDefaultKeys, nil)
	availableTools, err := bootstrap.FindAvailableTools(env, nil, nil, nil, false)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(availableTools, gc.HasLen, len(allTools))
	c.Assert(env.supportedArchitecturesCount, gc.Equals, 0)
}
开发者ID:pmatulis,项目名称:juju,代码行数:25,代码来源:tools_test.go

示例2: TestSupportedSeries

func (s *supportedSeriesWindowsSuite) TestSupportedSeries(c *gc.C) {
	expectedSeries := []string{
		"arch",
		"centos7",
		"precise",
		"quantal",
		"raring",
		"saucy",
		"trusty",
		"utopic",
		"vivid",
		"win10",
		"win2012",
		"win2012hv",
		"win2012hvr2",
		"win2012r2",
		"win2016",
		"win2016nano",
		"win7",
		"win8",
		"win81",
	}
	series := series.SupportedSeries()
	sort.Strings(series)
	c.Assert(series, gc.DeepEquals, expectedSeries)
}
开发者ID:tych0,项目名称:juju-utils,代码行数:26,代码来源:supportedseries_windows_test.go

示例3: TestUpdateSeriesVersions

func (s *supportedSeriesSuite) TestUpdateSeriesVersions(c *gc.C) {
	d := c.MkDir()
	filename := filepath.Join(d, "ubuntu.csv")
	err := ioutil.WriteFile(filename, []byte(distInfoData), 0644)
	c.Assert(err, jc.ErrorIsNil)
	s.PatchValue(series.DistroInfo, filename)

	expectedSeries := []string{"precise", "quantal", "raring", "saucy"}
	checkSeries := func() {
		series := series.SupportedSeries()
		sort.Strings(series)
		c.Assert(series, gc.DeepEquals, expectedSeries)
	}
	checkSeries()

	// Updating the file does not normally trigger an update;
	// we only refresh automatically one time. After that, we
	// must explicitly refresh.
	err = ioutil.WriteFile(filename, []byte(distInfoData2), 0644)
	c.Assert(err, jc.ErrorIsNil)
	checkSeries()

	expectedSeries = append(expectedSeries, "trusty")
	series.UpdateSeriesVersions()
	checkSeries()
}
开发者ID:anastasiamac,项目名称:utils,代码行数:26,代码来源:supportedseries_linux_test.go

示例4: TestSupportedSeries

func (s *supportedSeriesWindowsSuite) TestSupportedSeries(c *gc.C) {
	expectedSeries := []string{
		"arch",
		"centos7",

		"precise",
		"quantal",
		"raring",
		"saucy",
		"trusty",
		"utopic",
		"vivid",
		"wily",
		"xenial",

		"win10",
		"win2008r2",
		"win2012",
		"win2012hv",
		"win2012hvr2",
		"win2012r2",
		"win2016",
		"win2016nano",
		"win7",
		"win8",
		"win81",
	}
	series := series.SupportedSeries()
	c.Assert(series, jc.SameContents, expectedSeries)
}
开发者ID:anastasiamac,项目名称:utils,代码行数:30,代码来源:supportedseries_windows_test.go

示例5: NewImageConstraint

func NewImageConstraint(params simplestreams.LookupParams) *ImageConstraint {
	if len(params.Series) == 0 {
		params.Series = series.SupportedSeries()
	}
	if len(params.Arches) == 0 {
		params.Arches = arch.AllSupportedArches
	}
	return &ImageConstraint{LookupParams: params}
}
开发者ID:bac,项目名称:juju,代码行数:9,代码来源:simplestreams.go

示例6: TestSupportedSeries

func (s *supportedSeriesSuite) TestSupportedSeries(c *gc.C) {
	d := c.MkDir()
	filename := filepath.Join(d, "ubuntu.csv")
	err := ioutil.WriteFile(filename, []byte(distInfoData), 0644)
	c.Assert(err, jc.ErrorIsNil)
	s.PatchValue(series.DistroInfo, filename)

	expectedSeries := []string{"precise", "quantal", "raring", "saucy"}
	series := series.SupportedSeries()
	sort.Strings(series)
	c.Assert(series, gc.DeepEquals, expectedSeries)
}
开发者ID:yxg,项目名称:utils,代码行数:12,代码来源:supportedseries_linux_test.go

示例7: locallyBuildableTools

// locallyBuildableTools returns the list of tools that
// can be built locally, for series of the same OS.
func locallyBuildableTools() (buildable coretools.List) {
	for _, ser := range series.SupportedSeries() {
		if os, err := series.GetOSFromSeries(ser); err != nil || os != jujuos.HostOS() {
			continue
		}
		binary := version.Binary{
			Number: version.Current.Number,
			Series: ser,
			Arch:   arch.HostArch(),
		}
		// Increment the build number so we know it's a development build.
		binary.Build++
		buildable = append(buildable, &coretools.Tools{Version: binary})
	}
	return buildable
}
开发者ID:kakamessi99,项目名称:juju,代码行数:18,代码来源:tools.go

示例8: locallyBuildableTools

// locallyBuildableTools returns the list of tools that
// can be built locally, for series of the same OS.
func locallyBuildableTools(toolsSeries *string) (buildable coretools.List, _ version.Number) {
	buildNumber := jujuversion.Current
	// Increment the build number so we know it's a custom build.
	buildNumber.Build++
	for _, ser := range series.SupportedSeries() {
		if os, err := series.GetOSFromSeries(ser); err != nil || !os.EquivalentTo(jujuos.HostOS()) {
			continue
		}
		if toolsSeries != nil && ser != *toolsSeries {
			continue
		}
		binary := version.Binary{
			Number: buildNumber,
			Series: ser,
			Arch:   arch.HostArch(),
		}
		buildable = append(buildable, &coretools.Tools{Version: binary})
	}
	return buildable, buildNumber
}
开发者ID:bac,项目名称:juju,代码行数:22,代码来源:tools.go

示例9: makeToolsConstraint

func makeToolsConstraint(cloudSpec simplestreams.CloudSpec, stream string, majorVersion, minorVersion int,
	filter coretools.Filter) (*ToolsConstraint, error) {

	var toolsConstraint *ToolsConstraint
	if filter.Number != version.Zero {
		// A specific tools version is required, however, a general match based on major/minor
		// version may also have been requested. This is used to ensure any agent version currently
		// recorded in the environment matches the Juju cli version.
		// We can short circuit any lookup here by checking the major/minor numbers against
		// the filter version and exiting early if there is a mismatch.
		majorMismatch := majorVersion > 0 && majorVersion != filter.Number.Major
		minorMismacth := minorVersion != -1 && minorVersion != filter.Number.Minor
		if majorMismatch || minorMismacth {
			return nil, coretools.ErrNoMatches
		}
		toolsConstraint = NewVersionedToolsConstraint(filter.Number,
			simplestreams.LookupParams{CloudSpec: cloudSpec, Stream: stream})
	} else {
		toolsConstraint = NewGeneralToolsConstraint(majorVersion, minorVersion,
			simplestreams.LookupParams{CloudSpec: cloudSpec, Stream: stream})
	}
	if filter.Arch != "" {
		toolsConstraint.Arches = []string{filter.Arch}
	} else {
		logger.Tracef("no architecture specified when finding tools, looking for any")
		toolsConstraint.Arches = arch.AllSupportedArches
	}
	// The old tools search allowed finding tools without needing to specify a series.
	// The simplestreams metadata is keyed off series, so series must be specified in
	// the search constraint. If no series is specified, we gather all the series from
	// lucid onwards and add those to the constraint.
	var seriesToSearch []string
	if filter.Series != "" {
		seriesToSearch = []string{filter.Series}
	} else {
		seriesToSearch = series.SupportedSeries()
		logger.Tracef("no series specified when finding tools, looking for %v", seriesToSearch)
	}
	toolsConstraint.Series = seriesToSearch
	return toolsConstraint, nil
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:41,代码来源:tools.go


注:本文中的github.com/juju/utils/series.SupportedSeries函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。