[Et-mgmt-commits-list] [SCM] virt-factory branch, master now at fc3333ce70d1b53f0d432bee769daf9eaa6052f7

Scott Seago sseago at redhat.com
Sat May 12 04:23:46 UTC 2007


Hello,

This is an automated email from the git hooks/update script, it was
generated because a ref change was pushed to the repository.

Updating branch, master,
       via  fc3333ce70d1b53f0d432bee769daf9eaa6052f7 (commit)
       via  964ac71ff4204f1bb92680a355460cc9c1734700 (commit)
      from  a39694c8e06202410475fef8a146d0869240cfa3 (commit)

- Log -----------------------------------------------------------------
commit fc3333ce70d1b53f0d432bee769daf9eaa6052f7
Author: Scott Seago <sseago at redhat.com>
Date:   Sat May 12 00:23:38 2007 -0400

    profiles are now installed as RPMs. to generate the RPM, type 'make' in the
    profiles/foo directory as before. when the RPM is installed, vf_import is
    called in %post -- the RPM puts the puppet manifest/files in place, so
    vf_import no longer extracts a tarball -- it just does the site-wide
    manifes munging and the db imports.
    
    also new is vf_gen_profile_stub -- automates most of the profile generation
    process. It generates the makefile, specfile, and profile.xml and creates a
    blank init.pp. All of the attributes in profile.xml can be entered on the
    cmdline if desired, or the file can be edited directly later. The only
    required option is the profile name.
    
    Another functional change is that we're no longer downcasing the profile
    name when generating the puppet module (and thus the directory names) --
    the reason for this is that puppet module names are case sensitive, so we
    should preserver the case of the specified profile name.

commit 964ac71ff4204f1bb92680a355460cc9c1734700
Author: Scott Seago <sseago at redhat.com>
Date:   Sat May 12 00:14:25 2007 -0400

    refactored sample profiles to work with rpm-based profile install
-----------------------------------------------------------------------

Diffstat:
 {wui => profiles/Container}/Makefile               |   23 ++--
 .../{container => Container}/files/hello-world1    |    0 
 .../{container => Container}/files/hello-world2    |    0 
 .../{container => Container}/manifests/init.pp     |    4 +-
 profiles/{container => Container}/profile.xml      |    0 
 profiles/Container/version                         |    1 +
 profiles/Container/vf-profile-Container.spec       |   53 +++++++
 {wui => profiles/Test1}/Makefile                   |   23 ++--
 profiles/{container => Test1}/files/hello-world1   |    0 
 profiles/{container => Test1}/files/hello-world2   |    0 
 profiles/Test1/manifests/init.pp                   |   13 ++
 profiles/{test1 => Test1}/profile.xml              |    2 +-
 profiles/Test1/version                             |    1 +
 profiles/Test1/vf-profile-Test1.spec               |   53 +++++++
 {wui => profiles/Test1_x86_64}/Makefile            |   23 ++--
 .../{container => Test1_x86_64}/files/hello-world1 |    0 
 .../{container => Test1_x86_64}/files/hello-world2 |    0 
 profiles/Test1_x86_64/manifests/init.pp            |   13 ++
 .../{test1_x86_64 => Test1_x86_64}/profile.xml     |    2 +-
 profiles/Test1_x86_64/version                      |    1 +
 profiles/Test1_x86_64/vf-profile-Test1_x86_64.spec |   53 +++++++
 profiles/container/Makefile                        |    9 -
 profiles/test1/Makefile                            |    9 -
 profiles/test1/files/hello-world1                  |    1 -
 profiles/test1/files/hello-world2                  |    1 -
 profiles/test1/manifests/init.pp                   |   13 --
 service/MANIFEST.in                                |    3 +-
 {wui => service/profile-template}/Makefile         |   23 ++--
 service/profile-template/init.pp                   |    1 +
 service/profile-template/profile.xml.in            |   13 ++
 service/profile-template/vf-profile-template.spec  |   51 ++++++
 .../scripts/{vf_taskatron => vf_gen_profile_stub}  |    4 +-
 service/scripts/vf_import                          |   63 +-------
 service/server/gen_profile_stub.py                 |  164 ++++++++++++++++++++
 service/setup.py                                   |    8 +-
 service/virt-factory-server.spec                   |    7 +
 36 files changed, 496 insertions(+), 139 deletions(-)

diff --git a/wui/Makefile b/profiles/Container/Makefile
old mode 100644
new mode 100755
similarity index 60%
copy from wui/Makefile
copy to profiles/Container/Makefile
index 569e88a..de99ed8
--- a/wui/Makefile
+++ b/profiles/Container/Makefile
@@ -1,9 +1,10 @@
-VERSION		= $(shell echo `awk '{ print $$1 }' version`)
-RELEASE		= $(shell echo `awk '{ print $$2 }' version`)
+VERSION		= $(shell echo `awk '{ print $$2 }' version`)
+RELEASE		= $(shell echo `awk '{ print $$3 }' version`)
 NEWRELEASE	= $(shell echo $$(($(RELEASE) + 1)))
+PROFILE		= $(shell echo `awk '{ print $$1 }' version`)
 
-SPEC_FILE	= virt-factory-wui.spec
-NAME		= virt-factory-wui
+SPEC_FILE	= vf-profile-$(PROFILE).spec
+NAME		= vf-profile-$(PROFILE)
  
 NV		= $(NAME)-$(VERSION)
 RPM_FLAGS	=	--define "_topdir	%(pwd)/rpm-build" \
@@ -19,22 +20,24 @@ DATADIR		= $(shell rpm --eval "%{_datadir}")
 all: rpms
 
 bumprelease:	
-	-echo "$(VERSION) $(NEWRELEASE)" > version
+	-echo "$(PROFILE) $(VERSION) $(NEWRELEASE)" > version
 
 setversion: 
-	-echo "$(VERSION) $(RELEASE)" > version
+	-echo "$(PROFILE) $(VERSION) $(RELEASE)" > version
 
 
 clean:
-	-rm -f virt-factory*.gz virt-factory*.rpm 
-	-rm -rf virt-factory-wui-* dist build
+	-rm -f vf-profile*.gz vf-profile*.rpm 
+	-rm -rf vf-profile-${NAME}-* dist build
 
 
 tar:    clean
 	mkdir -p $(NV)
-	cp -a src conf $(NV)
+	mkdir -p manifests
+	mkdir -p files
+	mkdir -p templates
+	cp -a profile.xml manifests files templates $(NV)
 	find $(NV) \( -name '*~' -o -name '#*#' \) -print0 | xargs --no-run-if-empty --null rm -vf
-	find $(NV)/src/tmp -type f -print0 | xargs --no-run-if-empty --null rm -vf
 	mkdir -p rpm-build
 	tar zcvf rpm-build/$(NV).tar.gz $(NV)
 	cp version rpm-build/
diff --git a/profiles/container/files/hello-world1 b/profiles/Container/files/hello-world1
similarity index 100%
copy from profiles/container/files/hello-world1
copy to profiles/Container/files/hello-world1
diff --git a/profiles/container/files/hello-world2 b/profiles/Container/files/hello-world2
similarity index 100%
copy from profiles/container/files/hello-world2
copy to profiles/Container/files/hello-world2
diff --git a/profiles/container/manifests/init.pp b/profiles/Container/manifests/init.pp
old mode 100755
new mode 100644
similarity index 54%
rename from profiles/container/manifests/init.pp
rename to profiles/Container/manifests/init.pp
index 354e52f..eaea7a5
--- a/profiles/container/manifests/init.pp
+++ b/profiles/Container/manifests/init.pp
@@ -2,12 +2,12 @@
 
 class helloworld1 {
     file { "/tmp/hello-world1":
-        source => "puppet://$server/container/hello-world1"
+        source => "puppet://$server/Container/hello-world1"
     }
 }
 
 class helloworld2 {
     file { "/tmp/hello-world2":
-        source => "puppet://$server/container/hello-world2"
+        source => "puppet://$server/Container/hello-world2"
     }
 }
diff --git a/profiles/container/profile.xml b/profiles/Container/profile.xml
old mode 100755
new mode 100644
similarity index 100%
rename from profiles/container/profile.xml
rename to profiles/Container/profile.xml
diff --git a/profiles/Container/version b/profiles/Container/version
new file mode 100644
index 0000000..eadfea3
--- /dev/null
+++ b/profiles/Container/version
@@ -0,0 +1 @@
+Container 1 1
diff --git a/profiles/Container/vf-profile-Container.spec b/profiles/Container/vf-profile-Container.spec
new file mode 100644
index 0000000..41ffdee
--- /dev/null
+++ b/profiles/Container/vf-profile-Container.spec
@@ -0,0 +1,53 @@
+%define pbuild %{_builddir}/%{name}-%{version}
+%define profile_name %(echo `awk '{ print $1 }' %{SOURCE1}`)
+%define app_root %{_localstatedir}/lib/virt-factory/profiles/%{profile_name}
+
+Summary: sample container (host) appliance
+Source1: version
+Name: vf-profile-%{profile_name}
+Version: %(echo `awk '{ print $2 }' %{SOURCE1}`)
+Release: %(echo `awk '{ print $3 }' %{SOURCE1}`)%{?dist}
+License: GPL
+Group: Applications/System
+Requires: virt-factory-server >= 0.0.3
+URL: http://virt-factory.et.redhat.com
+Source0: %{name}-%{version}.tar.gz
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+%description
+sample container (host) appliance
+
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__install} -d -m0755 %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/manifests %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/files %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/templates %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/profile.xml %{buildroot}%{app_root}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%doc
+%attr(-, virtfact, virtfact) %{app_root}/profile.xml
+%attr(-, virtfact, virtfact) %{app_root}/manifests
+%attr(-, virtfact, virtfact) %{app_root}/files
+%attr(-, virtfact, virtfact) %{app_root}/templates
+
+%post
+vf_import %{profile_name}
+
+%changelog
+* Fri May 11 2007  <sseago at redhat.com> - profile-Container
+- Initial build.
+
diff --git a/wui/Makefile b/profiles/Test1/Makefile
old mode 100644
new mode 100755
similarity index 60%
copy from wui/Makefile
copy to profiles/Test1/Makefile
index 569e88a..de99ed8
--- a/wui/Makefile
+++ b/profiles/Test1/Makefile
@@ -1,9 +1,10 @@
-VERSION		= $(shell echo `awk '{ print $$1 }' version`)
-RELEASE		= $(shell echo `awk '{ print $$2 }' version`)
+VERSION		= $(shell echo `awk '{ print $$2 }' version`)
+RELEASE		= $(shell echo `awk '{ print $$3 }' version`)
 NEWRELEASE	= $(shell echo $$(($(RELEASE) + 1)))
+PROFILE		= $(shell echo `awk '{ print $$1 }' version`)
 
-SPEC_FILE	= virt-factory-wui.spec
-NAME		= virt-factory-wui
+SPEC_FILE	= vf-profile-$(PROFILE).spec
+NAME		= vf-profile-$(PROFILE)
  
 NV		= $(NAME)-$(VERSION)
 RPM_FLAGS	=	--define "_topdir	%(pwd)/rpm-build" \
@@ -19,22 +20,24 @@ DATADIR		= $(shell rpm --eval "%{_datadir}")
 all: rpms
 
 bumprelease:	
-	-echo "$(VERSION) $(NEWRELEASE)" > version
+	-echo "$(PROFILE) $(VERSION) $(NEWRELEASE)" > version
 
 setversion: 
-	-echo "$(VERSION) $(RELEASE)" > version
+	-echo "$(PROFILE) $(VERSION) $(RELEASE)" > version
 
 
 clean:
-	-rm -f virt-factory*.gz virt-factory*.rpm 
-	-rm -rf virt-factory-wui-* dist build
+	-rm -f vf-profile*.gz vf-profile*.rpm 
+	-rm -rf vf-profile-${NAME}-* dist build
 
 
 tar:    clean
 	mkdir -p $(NV)
-	cp -a src conf $(NV)
+	mkdir -p manifests
+	mkdir -p files
+	mkdir -p templates
+	cp -a profile.xml manifests files templates $(NV)
 	find $(NV) \( -name '*~' -o -name '#*#' \) -print0 | xargs --no-run-if-empty --null rm -vf
-	find $(NV)/src/tmp -type f -print0 | xargs --no-run-if-empty --null rm -vf
 	mkdir -p rpm-build
 	tar zcvf rpm-build/$(NV).tar.gz $(NV)
 	cp version rpm-build/
diff --git a/profiles/container/files/hello-world1 b/profiles/Test1/files/hello-world1
similarity index 100%
copy from profiles/container/files/hello-world1
copy to profiles/Test1/files/hello-world1
diff --git a/profiles/container/files/hello-world2 b/profiles/Test1/files/hello-world2
similarity index 100%
copy from profiles/container/files/hello-world2
copy to profiles/Test1/files/hello-world2
diff --git a/profiles/Test1/manifests/init.pp b/profiles/Test1/manifests/init.pp
new file mode 100644
index 0000000..e5e5db6
--- /dev/null
+++ b/profiles/Test1/manifests/init.pp
@@ -0,0 +1,13 @@
+# hello-world.pp
+
+class test11 {
+    file { "/tmp/hello-world1":
+        source => "puppet://$server/Test1/hello-world1"
+    }
+}
+
+class test12 {
+    file { "/tmp/hello-world2":
+        source => "puppet://$server/Test1/hello-world2"
+    }
+}
diff --git a/profiles/test1/profile.xml b/profiles/Test1/profile.xml
old mode 100755
new mode 100644
similarity index 86%
rename from profiles/test1/profile.xml
rename to profiles/Test1/profile.xml
index 6b21714..c46cc2d
--- a/profiles/test1/profile.xml
+++ b/profiles/Test1/profile.xml
@@ -9,5 +9,5 @@
   <kernel_options></kernel_options>
   <valid_targets>is_virt</valid_targets>
   <is_container>0</is_container>
-  <puppet_classes>site_settings class1 class2</puppet_classes>
+  <puppet_classes>test11 test12</puppet_classes>
 </appliance-container>
diff --git a/profiles/Test1/version b/profiles/Test1/version
new file mode 100644
index 0000000..3d6735e
--- /dev/null
+++ b/profiles/Test1/version
@@ -0,0 +1 @@
+Test1 1.234 1
diff --git a/profiles/Test1/vf-profile-Test1.spec b/profiles/Test1/vf-profile-Test1.spec
new file mode 100644
index 0000000..1887af6
--- /dev/null
+++ b/profiles/Test1/vf-profile-Test1.spec
@@ -0,0 +1,53 @@
+%define pbuild %{_builddir}/%{name}-%{version}
+%define profile_name %(echo `awk '{ print $1 }' %{SOURCE1}`)
+%define app_root %{_localstatedir}/lib/virt-factory/profiles/%{profile_name}
+
+Summary: sample virt (guest) appliance
+Source1: version
+Name: vf-profile-%{profile_name}
+Version: %(echo `awk '{ print $2 }' %{SOURCE1}`)
+Release: %(echo `awk '{ print $3 }' %{SOURCE1}`)%{?dist}
+License: GPL
+Group: Applications/System
+Requires: virt-factory-server >= 0.0.3
+URL: http://virt-factory.et.redhat.com
+Source0: %{name}-%{version}.tar.gz
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+%description
+sample virt (guest) appliance
+
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__install} -d -m0755 %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/manifests %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/files %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/templates %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/profile.xml %{buildroot}%{app_root}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%doc
+%attr(-, virtfact, virtfact) %{app_root}/profile.xml
+%attr(-, virtfact, virtfact) %{app_root}/manifests
+%attr(-, virtfact, virtfact) %{app_root}/files
+%attr(-, virtfact, virtfact) %{app_root}/templates
+
+%post
+vf_import %{profile_name}
+
+%changelog
+* Fri May 11 2007  <sseago at redhat.com> - profile-Container
+- Initial build.
+
diff --git a/wui/Makefile b/profiles/Test1_x86_64/Makefile
old mode 100644
new mode 100755
similarity index 60%
copy from wui/Makefile
copy to profiles/Test1_x86_64/Makefile
index 569e88a..de99ed8
--- a/wui/Makefile
+++ b/profiles/Test1_x86_64/Makefile
@@ -1,9 +1,10 @@
-VERSION		= $(shell echo `awk '{ print $$1 }' version`)
-RELEASE		= $(shell echo `awk '{ print $$2 }' version`)
+VERSION		= $(shell echo `awk '{ print $$2 }' version`)
+RELEASE		= $(shell echo `awk '{ print $$3 }' version`)
 NEWRELEASE	= $(shell echo $$(($(RELEASE) + 1)))
+PROFILE		= $(shell echo `awk '{ print $$1 }' version`)
 
-SPEC_FILE	= virt-factory-wui.spec
-NAME		= virt-factory-wui
+SPEC_FILE	= vf-profile-$(PROFILE).spec
+NAME		= vf-profile-$(PROFILE)
  
 NV		= $(NAME)-$(VERSION)
 RPM_FLAGS	=	--define "_topdir	%(pwd)/rpm-build" \
@@ -19,22 +20,24 @@ DATADIR		= $(shell rpm --eval "%{_datadir}")
 all: rpms
 
 bumprelease:	
-	-echo "$(VERSION) $(NEWRELEASE)" > version
+	-echo "$(PROFILE) $(VERSION) $(NEWRELEASE)" > version
 
 setversion: 
-	-echo "$(VERSION) $(RELEASE)" > version
+	-echo "$(PROFILE) $(VERSION) $(RELEASE)" > version
 
 
 clean:
-	-rm -f virt-factory*.gz virt-factory*.rpm 
-	-rm -rf virt-factory-wui-* dist build
+	-rm -f vf-profile*.gz vf-profile*.rpm 
+	-rm -rf vf-profile-${NAME}-* dist build
 
 
 tar:    clean
 	mkdir -p $(NV)
-	cp -a src conf $(NV)
+	mkdir -p manifests
+	mkdir -p files
+	mkdir -p templates
+	cp -a profile.xml manifests files templates $(NV)
 	find $(NV) \( -name '*~' -o -name '#*#' \) -print0 | xargs --no-run-if-empty --null rm -vf
-	find $(NV)/src/tmp -type f -print0 | xargs --no-run-if-empty --null rm -vf
 	mkdir -p rpm-build
 	tar zcvf rpm-build/$(NV).tar.gz $(NV)
 	cp version rpm-build/
diff --git a/profiles/container/files/hello-world1 b/profiles/Test1_x86_64/files/hello-world1
similarity index 100%
rename from profiles/container/files/hello-world1
rename to profiles/Test1_x86_64/files/hello-world1
diff --git a/profiles/container/files/hello-world2 b/profiles/Test1_x86_64/files/hello-world2
similarity index 100%
rename from profiles/container/files/hello-world2
rename to profiles/Test1_x86_64/files/hello-world2
diff --git a/profiles/Test1_x86_64/manifests/init.pp b/profiles/Test1_x86_64/manifests/init.pp
new file mode 100644
index 0000000..f33bf92
--- /dev/null
+++ b/profiles/Test1_x86_64/manifests/init.pp
@@ -0,0 +1,13 @@
+# hello-world.pp
+
+class test1164 {
+    file { "/tmp/hello-world1":
+        source => "puppet://$server/Test1_x86_64/hello-world1"
+    }
+}
+
+class test1164 {
+    file { "/tmp/hello-world2":
+        source => "puppet://$server/Test1_x86_64/hello-world2"
+    }
+}
diff --git a/profiles/test1_x86_64/profile.xml b/profiles/Test1_x86_64/profile.xml
old mode 100755
new mode 100644
similarity index 87%
copy from profiles/test1_x86_64/profile.xml
copy to profiles/Test1_x86_64/profile.xml
index e32a0a4..f8acb77
--- a/profiles/test1_x86_64/profile.xml
+++ b/profiles/Test1_x86_64/profile.xml
@@ -9,5 +9,5 @@
   <kernel_options></kernel_options>
   <valid_targets>is_virt</valid_targets>
   <is_container>0</is_container>
-  <puppet_classes>site_settings class1 class2</puppet_classes>
+  <puppet_classes>test1164 test1264</puppet_classes>
 </appliance-container>
diff --git a/profiles/Test1_x86_64/version b/profiles/Test1_x86_64/version
new file mode 100644
index 0000000..5ccb1cd
--- /dev/null
+++ b/profiles/Test1_x86_64/version
@@ -0,0 +1 @@
+Test1_x86_64 1.234 1
diff --git a/profiles/Test1_x86_64/vf-profile-Test1_x86_64.spec b/profiles/Test1_x86_64/vf-profile-Test1_x86_64.spec
new file mode 100644
index 0000000..41ffdee
--- /dev/null
+++ b/profiles/Test1_x86_64/vf-profile-Test1_x86_64.spec
@@ -0,0 +1,53 @@
+%define pbuild %{_builddir}/%{name}-%{version}
+%define profile_name %(echo `awk '{ print $1 }' %{SOURCE1}`)
+%define app_root %{_localstatedir}/lib/virt-factory/profiles/%{profile_name}
+
+Summary: sample container (host) appliance
+Source1: version
+Name: vf-profile-%{profile_name}
+Version: %(echo `awk '{ print $2 }' %{SOURCE1}`)
+Release: %(echo `awk '{ print $3 }' %{SOURCE1}`)%{?dist}
+License: GPL
+Group: Applications/System
+Requires: virt-factory-server >= 0.0.3
+URL: http://virt-factory.et.redhat.com
+Source0: %{name}-%{version}.tar.gz
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+%description
+sample container (host) appliance
+
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__install} -d -m0755 %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/manifests %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/files %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/templates %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/profile.xml %{buildroot}%{app_root}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%doc
+%attr(-, virtfact, virtfact) %{app_root}/profile.xml
+%attr(-, virtfact, virtfact) %{app_root}/manifests
+%attr(-, virtfact, virtfact) %{app_root}/files
+%attr(-, virtfact, virtfact) %{app_root}/templates
+
+%post
+vf_import %{profile_name}
+
+%changelog
+* Fri May 11 2007  <sseago at redhat.com> - profile-Container
+- Initial build.
+
diff --git a/profiles/container/Makefile b/profiles/container/Makefile
deleted file mode 100755
index 6230d8a..0000000
--- a/profiles/container/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-all:
-	tar cvf container.tar profile.xml files manifests
-	gzip container.tar --force
-
-clean:
-	-rm container.tar.gz
-
-install:
-	vf_import container.tar.gz
diff --git a/profiles/test1/Makefile b/profiles/test1/Makefile
deleted file mode 100755
index 239247d..0000000
--- a/profiles/test1/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-all:
-	tar cvf test1.tar profile.xml files manifests
-	gzip test1.tar --force
-
-install:
-	vf_import test1.tar.gz
-
-clean:
-	-rm test1.tar.gz
diff --git a/profiles/test1/files/hello-world1 b/profiles/test1/files/hello-world1
deleted file mode 100755
index d0f37f5..0000000
--- a/profiles/test1/files/hello-world1
+++ /dev/null
@@ -1 +0,0 @@
-First Hello World file
diff --git a/profiles/test1/files/hello-world2 b/profiles/test1/files/hello-world2
deleted file mode 100755
index 5370917..0000000
--- a/profiles/test1/files/hello-world2
+++ /dev/null
@@ -1 +0,0 @@
-Second Hello World file
diff --git a/profiles/test1/manifests/init.pp b/profiles/test1/manifests/init.pp
deleted file mode 100755
index 90072ae..0000000
--- a/profiles/test1/manifests/init.pp
+++ /dev/null
@@ -1,13 +0,0 @@
-# hello-world.pp
-
-class helloworld1 {
-    file { "/tmp/hello-world1":
-        source => "puppet://$server/test1/hello-world1"
-    }
-}
-
-class helloworld2 {
-    file { "/tmp/hello-world2":
-        source => "puppet://$server/test1/hello-world2"
-    }
-}
diff --git a/service/MANIFEST.in b/service/MANIFEST.in
index 4af4ce6..9d1b112 100644
--- a/service/MANIFEST.in
+++ b/service/MANIFEST.in
@@ -4,4 +4,5 @@ recursive-include kickstart *
 recursive-include docs *
 recursive-include db *
 recursive-include init-scripts *
-recursive-include puppet-config *
\ No newline at end of file
+recursive-include puppet-config *
+recursive-include profile-template *
diff --git a/wui/Makefile b/service/profile-template/Makefile
old mode 100644
new mode 100755
similarity index 60%
copy from wui/Makefile
copy to service/profile-template/Makefile
index 569e88a..de99ed8
--- a/wui/Makefile
+++ b/service/profile-template/Makefile
@@ -1,9 +1,10 @@
-VERSION		= $(shell echo `awk '{ print $$1 }' version`)
-RELEASE		= $(shell echo `awk '{ print $$2 }' version`)
+VERSION		= $(shell echo `awk '{ print $$2 }' version`)
+RELEASE		= $(shell echo `awk '{ print $$3 }' version`)
 NEWRELEASE	= $(shell echo $$(($(RELEASE) + 1)))
+PROFILE		= $(shell echo `awk '{ print $$1 }' version`)
 
-SPEC_FILE	= virt-factory-wui.spec
-NAME		= virt-factory-wui
+SPEC_FILE	= vf-profile-$(PROFILE).spec
+NAME		= vf-profile-$(PROFILE)
  
 NV		= $(NAME)-$(VERSION)
 RPM_FLAGS	=	--define "_topdir	%(pwd)/rpm-build" \
@@ -19,22 +20,24 @@ DATADIR		= $(shell rpm --eval "%{_datadir}")
 all: rpms
 
 bumprelease:	
-	-echo "$(VERSION) $(NEWRELEASE)" > version
+	-echo "$(PROFILE) $(VERSION) $(NEWRELEASE)" > version
 
 setversion: 
-	-echo "$(VERSION) $(RELEASE)" > version
+	-echo "$(PROFILE) $(VERSION) $(RELEASE)" > version
 
 
 clean:
-	-rm -f virt-factory*.gz virt-factory*.rpm 
-	-rm -rf virt-factory-wui-* dist build
+	-rm -f vf-profile*.gz vf-profile*.rpm 
+	-rm -rf vf-profile-${NAME}-* dist build
 
 
 tar:    clean
 	mkdir -p $(NV)
-	cp -a src conf $(NV)
+	mkdir -p manifests
+	mkdir -p files
+	mkdir -p templates
+	cp -a profile.xml manifests files templates $(NV)
 	find $(NV) \( -name '*~' -o -name '#*#' \) -print0 | xargs --no-run-if-empty --null rm -vf
-	find $(NV)/src/tmp -type f -print0 | xargs --no-run-if-empty --null rm -vf
 	mkdir -p rpm-build
 	tar zcvf rpm-build/$(NV).tar.gz $(NV)
 	cp version rpm-build/
diff --git a/service/profile-template/init.pp b/service/profile-template/init.pp
new file mode 100644
index 0000000..16ee7b9
--- /dev/null
+++ b/service/profile-template/init.pp
@@ -0,0 +1 @@
+# init.pp
diff --git a/service/profile-template/profile.xml.in b/service/profile-template/profile.xml.in
new file mode 100755
index 0000000..20e1a8a
--- /dev/null
+++ b/service/profile-template/profile.xml.in
@@ -0,0 +1,13 @@
+<?xml version='1.0' encoding='utf-8'?>
+<appliance-container>
+  <name>$name</name>
+  <version>$version</version>
+  <distribution>$distribution</distribution>
+  <virt_storage_size>$storage</virt_storage_size>
+  <virt_ram>$ram</virt_ram>
+  <kickstart_metadata>$ksmetadata</kickstart_metadata>
+  <kernel_options>$koptions</kernel_options>
+  <valid_targets>$targets</valid_targets>
+  <is_container>$container</is_container>
+  <puppet_classes>$puppetclasses</puppet_classes>
+</appliance-container>
diff --git a/service/profile-template/vf-profile-template.spec b/service/profile-template/vf-profile-template.spec
new file mode 100644
index 0000000..7e9750e
--- /dev/null
+++ b/service/profile-template/vf-profile-template.spec
@@ -0,0 +1,51 @@
+%define pbuild %{_builddir}/%{name}-%{version}
+%define profile_name %(echo `awk '{ print $1 }' %{SOURCE1}`)
+%define app_root %{_localstatedir}/lib/virt-factory/profiles/%{profile_name}
+
+Summary: 
+Source1: version
+Name: vf-profile-%{profile_name}
+Version: %(echo `awk '{ print $2 }' %{SOURCE1}`)
+Release: %(echo `awk '{ print $3 }' %{SOURCE1}`)%{?dist}
+License: GPL
+Group: Applications/System
+Requires: virt-factory-server >= 0.0.3
+URL: http://virt-factory.et.redhat.com
+Source0: %{name}-%{version}.tar.gz
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+%description
+
+
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__install} -d -m0755 %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/manifests %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/files %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/templates %{buildroot}%{app_root}
+%{__cp} -a %{pbuild}/profile.xml %{buildroot}%{app_root}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%doc
+%attr(-, virtfact, virtfact) %{app_root}/profile.xml
+%attr(-, virtfact, virtfact) %{app_root}/manifests
+%attr(-, virtfact, virtfact) %{app_root}/files
+%attr(-, virtfact, virtfact) %{app_root}/templates
+
+%post
+vf_import %{profile_name}
+
+%changelog
+
diff --git a/service/scripts/vf_taskatron b/service/scripts/vf_gen_profile_stub
old mode 100755
new mode 100644
similarity index 69%
copy from service/scripts/vf_taskatron
copy to service/scripts/vf_gen_profile_stub
index 02358dc..64d6d21
--- a/service/scripts/vf_taskatron
+++ b/service/scripts/vf_gen_profile_stub
@@ -6,8 +6,8 @@ import distutils.sysconfig
 
 sys.path.append("%s/virt-factory" % distutils.sysconfig.get_python_lib())
 
-from server import taskatron
+from server import gen_profile_stub
 
 if __name__ == "__main__":
-    taskatron.main(sys.argv)
+    gen_profile_stub.main(sys.argv)
 
diff --git a/service/scripts/vf_import b/service/scripts/vf_import
index 9587501..e2ad139 100755
--- a/service/scripts/vf_import
+++ b/service/scripts/vf_import
@@ -62,10 +62,7 @@ from server.modules import provisioning
 # TODO: should go in /var/lib/puppet/config/lib once puppet modules work
 PUPPET_FILE_DIR="/var/lib/virt-factory/profiles"
 PUPPET_SITE_MANIFEST="/etc/puppet/manifests/site.pp"
-PUPPET_FILESERVER_CONF="/etc/puppet/fileserver.conf"
-PUPPET_FILESERVER_ALLOW="*"
 
-PROFILE_REGEXP = "profile\.xml$"
 NAME_TAG = "name"
 VERSION_TAG = "version"
 DISTRIBUTION_TAG = "distribution"
@@ -84,48 +81,17 @@ class VirtFactoryImporter:
    Main class for sm_import tool
    """
 
-   def __init__(self, tarball, module_dir, manifest, fileserver_conf, fileserver_allow):
+   def __init__(self, module_name, module_dir, manifest):
        """
        create importer object -- source tarball is passed in
        """
-       tarball = self.handle_network_file(tarball)
-       if (not tarfile.is_tarfile(tarball)):
-           raise ValueError(tarball + " is not a tarfile")
-       self.tarball_path = tarball
+       self.module_name = module_name
        self.module_dir = module_dir
        self.manifest = manifest
-       self.fileserver_conf = fileserver_conf
-       self.fileserver_allow = fileserver_allow
        log = logger.Logger()
        self.logger = log.logger
+       self.profile = parse(self.module_dir + '/' + self.module_name + "/profile.xml")
 
-   def handle_network_file(self, tarball):
-      try:
-         protocol = tarball[0:tarball.index("://")]
-         (handle, path) = tempfile.mkstemp()
-         os.close(handle)
-         urlretrieve(tarball, path)
-         return path
-      except ValueError:
-         return tarball
-
-   def extract(self):
-        self.tarball = tarfile.open(self.tarball_path)
-        profile_member = self.tarball.getmember("profile.xml")
-        profile_xml = self.tarball.extractfile(profile_member)
-        self.profile = parse(profile_xml)
-        self.module_name = self.get_node_text(NAME_TAG).lower()
-        
-        for member in self.tarball.getmembers():
-            if (re.search(PROFILE_REGEXP, member.name)):
-                print "excluding ", member.name
-            else:
-                print "extracting ", member.name
-                self.tarball.extract(member, self.module_extraction_dir())
-
-   def module_extraction_dir(self):
-       return self.module_dir + '/' + self.module_name
-   
    def update_puppet_manifest(self):
        # import_str should be simply "import profile_name" once
        # puppet module support is in place
@@ -137,16 +103,6 @@ class VirtFactoryImporter:
            manifest_file.write('\n' + import_str + '\n')
            manifest_file.close();
 
-       # fileserver hacking shouldn't be required anymore w/ modules
-       #fileserver_str = '\[' + self.module_name + '\]'
-       #if not self.search_for_in_file(self.fileserver_conf, fileserver_str):
-       #    #fileserver_conf_file = open(self.fileserver_conf)
-       #    print "creating new fileserver conf entry"
-       #    fileserver_conf_file = open(self.fileserver_conf, 'a')
-       #    fileserver_conf_file.write('\n [' + self.module_name + ']\n')
-       #    fileserver_conf_file.write('  path ' + self.module_extraction_dir() + '/files\n')
-       #    fileserver_conf_file.write('  allow '+ self.fileserver_allow + '\n')
-       #    fileserver_conf_file.close();
 
    def search_for_in_file(self, filename, search_str):
        file = open(filename)
@@ -220,7 +176,7 @@ def main():
     Start things up.
     """
     
-    usage = "usage: %prog [options] appliance-spec-file"
+    usage = "usage: %prog [options] module-name"
     parser = OptionParser(usage=usage)
     parser.add_option("-d", "--module-dir", dest="module",
                       help="top-level puppet module directory",
@@ -228,20 +184,11 @@ def main():
     parser.add_option("-m", "--site-wide-manifest", dest="manifest",
                       help="puppet site-wide manifest",
                       default=PUPPET_SITE_MANIFEST)
-    parser.add_option("-f", "--fileserver-conf", dest="fileserver_conf",
-                      help="puppet fileserver configuration file",
-                      default=PUPPET_FILESERVER_CONF)
-    parser.add_option("-a", "--fileserver-allow", dest="fileserver_allow",
-                      help="Allowed hosts for puppet fileserver config (default *)",
-                      default=PUPPET_FILESERVER_ALLOW)
     
     (options, args) = parser.parse_args()
     if len(args) != 1:
         parser.error("incorrect number of arguments")    
-    importer = VirtFactoryImporter(args[0], options.module, options.manifest,
-                              options.fileserver_conf, options.fileserver_allow)
-    print "extracting..."
-    importer.extract()
+    importer = VirtFactoryImporter(args[0], options.module, options.manifest)
     importer.update_puppet_manifest()
     print "populating..."
     importer.populate_sm_profile()
diff --git a/service/server/gen_profile_stub.py b/service/server/gen_profile_stub.py
new file mode 100644
index 0000000..2e65539
--- /dev/null
+++ b/service/server/gen_profile_stub.py
@@ -0,0 +1,164 @@
+#!/usr/bin/python
+
+"""
+gen_profile_stub: generates initial build and file template for a profile
+
+Copyright 2007, Red Hat, Inc
+Michael DeHaan <mdehaan at redhat.com>
+Adrian Likins <alikins at redhat.com>
+Scott Seago <sseago at redhat.com>
+
+XMLRPCSSL portions based on http://linux.duke.edu/~icon/misc/xmlrpcssl.py
+
+This software may be freely redistributed under the terms of the GNU
+general public license.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+from optparse import OptionParser
+import os
+import re
+import shutil
+import sys
+
+from Cheetah.Template import Template
+
+
+class GenProfileStub(object):
+   def __init__(self, options):
+       self.name = options.name
+       self.version = options.version
+       self.release = options.release
+       self.storage = options.storage
+       self.distribution = options.distribution
+       self.ram = options.ram
+       self.ksmetadata = options.ksmetadata
+       self.koptions = options.koptions
+       self.targets = options.targets
+       self.container = options.container
+       self.puppetclasses = options.puppetclasses
+
+   def generate(self):
+       self.gen_profile_dirs()
+       self.gen_version_file()
+       self.copy_template_files()
+       
+   def gen_profile_dirs(self):
+       os.mkdir(self.name)
+       os.mkdir(self.name + "/manifests")
+       os.mkdir(self.name + "/files")
+       os.mkdir(self.name + "/templates")
+       
+   def gen_version_file(self):
+       version_str = self.name + " " + self.version + " " + self.release + "\n"
+       fd1 = open(self.name + "/version","w+")
+       fd1.write(version_str)
+       fd1.close()
+
+   def copy_template_files(self):
+       shutil.copy("/usr/share/virt-factory/profile-template/Makefile", self.name)
+       shutil.copy("/usr/share/virt-factory/profile-template/vf-profile-template.spec", self.name + "/vf-profile-" + self.name + ".spec")
+       print "Edit spec file and fill in Summary, description, and changelog"
+       shutil.copy("/usr/share/virt-factory/profile-template/init.pp", self.name + "/manifests")
+       template_file = open("/usr/share/virt-factory/profile-template/profile.xml.in","r")
+       template_data = template_file.read()
+       template_file.close()
+       metadata = {
+           "name" : self.name,
+           "version" : self.version,
+           "release" : self.release,
+           "storage" : self.storage,
+           "distribution" : self.distribution,
+           "ram" : self.ram,
+           "ksmetadata" : self.ksmetadata,
+           "koptions" : self.koptions,
+           "targets" : self.targets,
+           "container" : self.container,
+           "puppetclasses" : self.puppetclasses
+       }
+       self.apply_template(template_data, metadata, self.name + "/profile.xml")
+
+   def apply_template(self, data_input, metadata, out_path):
+       """
+       Take filesystem file profile.xml, apply metadata using
+       Cheetah and save as out_path.
+       """
+
+
+       if type(data_input) != str:
+           data = data_input.read()
+       else:
+           data = data_input
+
+       data = "#errorCatcher Echo\n" + data
+       
+       t = Template(source=data, searchList=[metadata])
+       data_out = str(t)
+       if out_path is not None:
+           #os.makedirs(os.path.dirname(out_path))
+           fd = open(out_path, "w+")
+           fd.write(data_out)
+           fd.close()
+       return data_out
+
+
+#--------------------------------------------------------------------------
+
+def main(argv):
+    """
+    Start things up.
+    """
+    usage = "usage: %prog [options] "
+    parser = OptionParser(usage=usage)
+    parser.add_option("-n", "--name", dest="name",
+                      help="profile name")
+    parser.add_option("-v", "--version", dest="version",
+                      help="profile version",
+                      default="0.0.1")
+    parser.add_option("-r", "--release", dest="release",
+                      help="profile rpm release",
+                      default="1")
+    parser.add_option("-d", "--distribution", dest="distribution",
+                      help="profile distribution",
+                      default="")
+    parser.add_option("-s", "--storage", dest="storage",
+                      help="profile virt storage size",
+                      default="")
+    parser.add_option("-m", "--ram", dest="ram",
+                      help="profile virt ram",
+                      default="")
+    parser.add_option("-k", "--ksmetadata", dest="ksmetadata",
+                      help="profile kickstart metadata",
+                      default="")
+    parser.add_option("-o", "--koptions", dest="koptions",
+                      help="profile kernel options",
+                      default="")
+    parser.add_option("-t", "--targets",
+                      dest="targets", type="choice", choices=["is_virt", "is_baremetal", "is_either"], default=None,
+                      help="Valid target type for the profile (i.e. for virt vs. baremetal provisioning).")
+    parser.add_option("-c", "--container",
+                      dest="container", type="choice", choices=["0", "1"], default="0",
+                      help="Whether a host running this profile is a valid target for VM guests.")
+    parser.add_option("-p", "--puppetclasses", dest="puppetclasses",
+                      help="profile puppet classes",
+                      default="")
+
+    (options, args) = parser.parse_args()
+    if not options.name:
+        parser.error("name is required")
+    else:
+        match = re.search("\W+", options.name)
+        if match:
+            print "profile name must contain only alphanumeric characters and underscores. Specified name includes '" + match.group() + "'"
+            sys.exit(1)
+
+    gen_profile = GenProfileStub(options)
+    gen_profile.generate();
+    
+if __name__ == "__main__":
+    main(sys.argv)
+
+
diff --git a/service/setup.py b/service/setup.py
index 6e6bd93..9bc13d4 100644
--- a/service/setup.py
+++ b/service/setup.py
@@ -23,6 +23,7 @@ if __name__ == "__main__":
 	upgradepath = schemapath + "upgrade/"
 	puppetpath = "/usr/share/%s/puppet-config/" % NAME
 	manifestpath = "/etc/puppet/manifests/"
+	profiletemplatepath = "/usr/share/%s/profile-template/" % NAME
         setup(
                 name="%s-server" % NAME,
                 version = VERSION,
@@ -38,6 +39,7 @@ if __name__ == "__main__":
 			   "scripts/vf_upgrade_db",
 			   "scripts/vf_config_firewall",
 			   "scripts/vf_remove_firewall_rules",
+			   "scripts/vf_gen_profile_stub",
 			   "db/vf_create_db.sh"],
 		package_dir = {"%s" % NAME: "",
 			       "%s/server" % NAME: "server",
@@ -59,7 +61,11 @@ if __name__ == "__main__":
 					     glob.glob("db/schema/upgrade/*.sql")),
 			      (puppetpath, ["puppet-config/puppetmaster", 
 					    "puppet-config/puppetd.conf"]),
-			      (manifestpath, ["puppet-config/site.pp"])],
+			      (manifestpath, ["puppet-config/site.pp"]),
+			      (profiletemplatepath, ["profile-template/Makefile",
+                                                     "profile-template/profile.xml.in",
+                                                     "profile-template/vf-profile-template.spec",
+                                                     "profile-template/init.pp"])],
                 description = SHORT_DESC,
                 long_description = LONG_DESC
         )
diff --git a/service/virt-factory-server.spec b/service/virt-factory-server.spec
index ef7e586..d5c6386 100644
--- a/service/virt-factory-server.spec
+++ b/service/virt-factory-server.spec
@@ -44,6 +44,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
 %{_bindir}/vf_upgrade_db
 %{_bindir}/vf_config_firewall
 %{_bindir}/vf_remove_firewall_rules
+%{_bindir}/vf_gen_profile_stub
 /etc/init.d/virt-factory-server
 %dir /var/lib/virt-factory
 %config(noreplace) /etc/virt-factory/settings
@@ -69,6 +70,12 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
 /etc/puppet/manifests/site.pp
 /usr/share/virt-factory/puppet-config/puppetmaster
 /usr/share/virt-factory/puppet-config/puppetd.conf
+%dir /usr/share/virt-factory/profile-template
+/etc/puppet/manifests/site.pp
+/usr/share/virt-factory/profile-template/Makefile
+/usr/share/virt-factory/profile-template/profile.xml.in
+/usr/share/virt-factory/profile-template/vf-profile-template.spec
+/usr/share/virt-factory/profile-template/init.pp
 %dir /var/log/virt-factory
 
 

hooks/update
---
Git Source Code Management System
hooks/update refs/heads/master \
  a39694c8e06202410475fef8a146d0869240cfa3 \
  fc3333ce70d1b53f0d432bee769daf9eaa6052f7




More information about the Et-mgmt-commits-list mailing list